Closed
Description
The final example in this section has a bug:
namespace N1 { static class A { public static void M(string s){} } static class B : A { public static void M2(string s){} } } namespace N2 { using static N1.B; class C { void N() { M2("B"); // OK, calls B.M2 M("C"); // Error. M unknown } } }
Based on the comment near the end, the intent is that an error results based on M
being unknown. However, the compiler doesn't get that far. Instead, it complains about the declaration
static class B : A
According to 14.2.2.4.1, a static class (such as A
) cannot be used as a base class, and a static class (such as B
) cannot derive from anything other than object
. So, the program is ill-formed.
Blame says this example was added in July 2021, in V6.
I didn't see an obvious workaround.