-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[Default Interfaces] Support constrained interface calls on value types #9490
Comments
The following code compiles and runs without throwing. Not sure what scenario is not handled properly. using System;
class Program
{
static void Main(string[] args)
{
S1 s = new S1();
M(s);
}
static void M<T>(T t) where T : I1
{
t.M();
}
}
interface I1
{
void M() { Console.WriteLine("I1.M"); }
}
struct S1 : I1
{
} |
It's specifically for the corner case mentioned in the pull request (there is an il test too). |
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process. This process is part of our issue cleanup automation. |
This issue will now be closed since it had been marked |
Pull request dotnet/coreclr#21978 made us throw in this situation, but the correct behavior would be to make a thunk that will box the
this
, and dispatch to the target default interface method.The text was updated successfully, but these errors were encountered: