Home Dashboard Directory Help
Search

Visual C++ does not handle based enums correctly by Alf P. Steinbach, except MS doesn't accept it


Status: 

Closed
 as Fixed Help for as Fixed


3
0
Sign in
to vote
Type: Bug
ID: 699236
Opened: 11/4/2011 9:31:43 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
view
3
User(s) can reproduce this bug

Description

Up to and including Visual C++ 11 (I only have the preview of that compiler) the following code fails to compile:

#ifdef _MSC_VER
# pragma warning( disable: 4480 )     // enum base as "nonstandard extension"
#endif
enum ShouldBeFine: char { hola };

enum Choice { a, b, c };

template< Choice c > struct Traits;

template<> struct Traits<a> { typedef char Type; };
template<> struct Traits<b> { typedef wchar_t Type; };
template<> struct Traits<c> { typedef long Type; };

template< Choice c >
struct Blah
{
    enum X: typename Traits<c>::Type {};
};

int main()
{}
Details
Sign in to post a comment.
Posted by Microsoft on 11/17/2011 at 8:07 PM
Hi: this issue has been fixed. The fix should show up in a future release of Visual C++.

Thank you for reporting the issue.

Jonathan Caves
Visual C++ Compiler Team
Posted by MS-Moderator09 [Feedback Moderator] on 11/6/2011 at 7:31 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 11/6/2011 at 6:30 PM
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.
File Name Submitted By Submitted On File Size  
msvc_enum_base.cpp 11/4/2011 455 bytes