Hi Jeroen, 

The C# spec explicitly states that the language does not support static
members in interfaces (section 13.2, last sentence of first paragraph
after the grammar).

Also note that an interface containing a static method is not CLS
compliant, so C# is not required to support them.  In particular, you
cannot call one.

However the .NET Framework v1 implementation (and the SSCLI
implementation) doesn't have the most crisply defined outcome in this
case (which you've uncovered) and "odd things" occur under in this
situation.  There's a bug entered against this and the proposed fix
would be to simply ignore all static methods in interfaces that it
imports.  This behavior is consistent with what happens when C#
encounters fields in interfaces.

John

This posting is provided "AS IS" with no warranties, and confers no
rights.


-----Original Message-----
From: Jeroen Frijters [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, August 13, 2002 1:10 AM
To: [EMAIL PROTECTED]
Subject: BUG: C# compiler cannot handle interfaces with static methods


There are multiple bugs in the C# compiler wrt interfaces that contain
static methods:
- interfaces containing static methods cannot be implemented
(clr\src\csharp\csharp\sccomp\clsdrec.cpp line 5090 should have: if
(member->asMETHSYM()->isStatic) continue;)
- calls to static methods in interfaces are compiled incorrectly
- static methods in implemented interfaces are not visible in the class
that implements the interface

Regards,
Jeroen

Reply via email to