Search

Compiler error (C3431) using elaborated type specifiers for scoped enumerations by Nico Rieck

Closed
as Deferred Help for as Deferred

2
0
Sign in
to vote
Type: Bug
ID: 771978
Opened: 11/22/2012 9:49:42 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
ISO/IEC 14882:2011 section 7.1.6.3 [dcl.type.elab]/3 states: "[...] the enum keyword shall be used to refer to an enumeration [...]".

When using an elaborated type specifier for a scoped enumeration, Visual C++ incorrectly requires "enum class":

enum class E { };
enum class E e1; // incorrect, but compiles
enum E e2; // correct, but yields: error C3431: 'E' : a scoped enumeration cannot be redeclared as an unscoped enumeration

Intellisense parses this correctly, and complains about the variant the compiler accepts.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

Visual Studio 2012

Steps to reproduce

Compile:

enum class E { };
enum E e;

Product Language

English

Operating System

Any

Operating System Language

English

Actual results

error C3431: 'E' : a scoped enumeration cannot be redeclared as an unscoped enumeration

Expected results

No compilation error.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 11/22/2012 at 6:46 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 11/22/2012 at 10:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.