[cfe-commits] Microsoft extension (enum 'enum' used in qualified name)

Sebastian Redl sebastian.redl at getdesigned.at
Thu Apr 19 13:56:23 PDT 2012


On 19.04.2012, at 22:22, Nikola Smiljanic wrote:

> Microsoft allows code like this:
> 
> struct S {
>   enum E { a };
> };
> 
> int i = S::E::a;   // C4482
> http://msdn.microsoft.com/en-us/library/ms173704.aspx
> int j = S::a;   // OK
> 
> This is my attempt to make this compile this when -fms-extensions is
> used. I think that my comment could be better but I'm not very good at
> explaining these things. I have no idea what to do with this test file
> so I'm attaching it in addition to the patch. What do you think?

The test file be merged into the appropriate test case in SemaCXX, probably MicrosoftExtensions.cpp.

The comment is fine as it is.

You should emit a warning that this is a Microsoft extension.

The real question is what how much code depends on this. I'm not sure, but I think we generally try not to support every oddity the MS compiler allows, only those that are necessary to parse system headers (including MS-supplied libraries like MFC and ATL) or else are very common. If they just occasionally appear in client code, it would be better to fix that code.

Sebastian





More information about the cfe-commits mailing list