This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/61491] New: An explicit specialization of a member enumeration of a class template is rejected


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61491

            Bug ID: 61491
           Summary: An explicit specialization of a member enumeration of
                    a class template is rejected
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ville.voutilainen at gmail dot com

#include <iostream>

template <class D> struct Base 
{ 
    enum class E : unsigned; 
    E e; 
    Base(E e) : e(e) {} 
}; 

struct X; 

template<> enum class Base<X>::E : unsigned { a, b }; 

struct X : Base<X> 
{ 
    X() : Base<X>(E::b) {} 
};

int main()
{ 
    X x; 
    std::cout << static_cast<unsigned>(x.e) << std::endl;
}

[ville@localhost ~]$ g++ --std=c++11 -pedantic -o plash plash.cpp 
plash.cpp:12:52: warning: template specialization of âenum class Base<X>::Eâ
not allowed by ISO C++ [-Wpedantic]
 template<> enum class Base<X>::E : unsigned { a, b }; 
                                                    ^
Clang accepts the code.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]