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
C# 7 section 15.3.10.1 (Reserved member names / General) says
It is a compile-time error for a program to declare a member whose signature matches a signature reserved by a member declared in the same scope, even if […]
But it should also be a compile-time error if the program declares a non-method member whose name matches such a reserved name, even though the signature won't match then.
usingSystem.Runtime.CompilerServices;classC{~C(){}// error CS0102: The type 'C' already contains a definition for 'Finalize'[IndexerName("Finalize")]intthis[inti]=>0;}
Here, the indexer would be encoded in ECMA-335 metadata as an indexed property named Finalize and a method named get_Finalize. The property then clashes with the reserved method name of the ~C() finalizer but neither ECMA-334 nor ECMA-335 seems to forbid the name from being overloaded in this way.
See also #1303 about IndexerNameAttribute in general.
Describe the bug
C# 7 section 15.3.10.1 (Reserved member names / General) says
But it should also be a compile-time error if the program declares a non-method member whose name matches such a reserved name, even though the signature won't match then.
Example
Expected behavior
This should be a compile-time error.
Additional context
Inspired by #1302.
The text was updated successfully, but these errors were encountered: