[PATCH] Provide fixit if unscoped enumeration is used in nested name specifier. This fixes PR16951.

Richard Smith richard at metafoo.co.uk
Thu Jan 15 14:48:08 PST 2015


On Thu, Jan 15, 2015 at 7:46 AM, Serge Pavlov <sepavloff at gmail.com> wrote:
> MSVC supported using an enumerator as a nested-name-specifier for a long time.

MSVC does not have a way to turn off C++11 extensions. It is not
useful to add MS extensions for code that's accepted in C++11 mode,
because anyone using MS extensions should also have C++11 enabled.

> For instance, VS2005 compiled the code:
>
>   enum ABCD { A, B, C };
>
>   int main() {
>     return ABCD::A;
>   }
>
> without errors:
>
>   C:\Tools>cl tt.cpp
>   Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
>   Copyright (C) Microsoft Corporation.  All rights reserved.
>
>   tt.cpp
>   tt.cpp(4) : warning C4482: nonstandard extension used: enum 'ABCD' used in qualified name
>   Microsoft (R) Incremental Linker Version 8.00.50727.42
>   Copyright (C) Microsoft Corporation.  All rights reserved.
>
>   /out:tt.exe
>   tt.obj
>
>   C:\Tools>
>
> VS2010 compiles this code without warnings by default. It is reasonable to accept this code in Microsoft mode without warnings by default, isn't it?
>
> However, complaining on using extension make the patch simpler, will update it.
>
>
> http://reviews.llvm.org/D6389
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>



More information about the cfe-commits mailing list