dotnet / dotnet/csharpstandard
Incorrect compiler diagnostic for hidden virtual member
Open
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
The C# compiler produces an error for this
``` cs
abstract class A
{
public abstract void M();
}
abstract class B: A
{
// (?) It is an error to hide an inherited abstract member by a
// member whose access level is public, protected internal, or protected.
public new int M = 0; // error: B.M hides inherited member A.M()
}
```
But the error is not justified by anything (that I could find) in the C# language specification. We should either describe the required error in the C# specification or modify the compiler to stop producing it.
@AlekseyTs @MadsTorgersen
Contributor guide
Assessment
This issue has not been assessed yet.