Tested with a daily SDK build (7.0.100-preview.7.22358.13):
unsafe
{
var byref = default(ByReference<int>);
var byptr = &byref; // does not error
}
readonly ref struct ByReference<T>
{
public readonly ref T Value;
}
Expected Behavior:
error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('ByReference<int>')
Actual Behavior:
The code compiles successfully.