You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An implicit dynamic conversion exists from an expression of type dynamic to any type T.
Except this is not true, an implicit conversion does not exist from an expression of type dynamic to a pointer type. E.g.:
unsafe
{dynamicd=null;void*x=d;}
This produces the following error:
CS0029 Cannot implicitly convert type 'dynamic' to 'void*'
I think the compile error is correct and that the specification is unclear: when it says "any type", it means "any safe type". While everything related to unsafe code is generally in its own separate section, I think it would be clearer if it was spelled out that dynamic is not convertible to pointer types, possibly like this:
An implicit dynamic conversion exists from an expression of type dynamic to any value type, reference type or type parameter T.
The text was updated successfully, but these errors were encountered:
The C# specification says this about Explicit dynamic conversions:
Except this is not true, an implicit conversion does not exist from an expression of type
dynamic
to a pointer type. E.g.:This produces the following error:
I think the compile error is correct and that the specification is unclear: when it says "any type", it means "any safe type". While everything related to unsafe code is generally in its own separate section, I think it would be clearer if it was spelled out that
dynamic
is not convertible to pointer types, possibly like this:The text was updated successfully, but these errors were encountered: