-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: Make generic types with explicit layout a compiler error #8456
Comments
While this is not illegal (C#), I think there should be at least a warning, if detectable. I am not sure if this is forbidden in the CLR or just a limitation that could be done in some other implementation. |
Presumably this wouldn't be the case if T1 and T2 were both constrained to be reference types? |
@jskeet This happens when constrained too. This also happens with a class with explicit layout. |
This also fails in the following scenario, even though the size can be reliably determined:
Maybe a runtime issue? |
The following compiles, but results in a TypeLoadException:
Given it will always fail at runtime, should this not be considered to be a compiler error instead?
The text was updated successfully, but these errors were encountered: