11.8 Method group conversions requires error even if the conversion isn't used #188
Labels
status: gnarly
This issue is likely to require very significant work to resolve
type: bug
The Standard does not describe the language as intended or implemented
Consider this little test program
The first argument in the call
D(Y, 1)
is a method group. During overload resolution, we will seek the existence of a method group conversion to see which methods are applicable.There is an implicit conversion from argument
Y
to the first parameter of the firstD
method, according to 11.8:There certainly is a best method, as there is only one
Y
. But sinceY
is not compatible with the delegate typeMyAction<int>
, a compile-time error occurs. This is even though the compiler would not even try to apply that conversion, instead selecting the other overload ofD
as the one to be called!Actual compilers do not report this compile-time error unless the conversion is attempted to be used. This test program compiles and runs.
The text was updated successfully, but these errors were encountered: