http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51145

             Bug #: 51145
           Summary: [C++11][DR1131] Alias template in
                    elaborated-type-specifier accepted
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: daniel.krueg...@googlemail.com
                CC: ja...@redhat.com


gcc 4.7.0 20111112 (experimental) in C++11 mode accepts the following code:

//---
struct A {};

template<class>
using X = A;

struct X<int>* px;

template<int>
using Y = A;

struct Y<0>* py;
//---

According to 7.1.6.3 [dcl.type.elab] p2 both elaborated-type-specifier usages
in the definition of px and py should be rejected:

"If the identifier resolves to a typedef-name or the simple-template-id
resolves to an alias template specialization, the elaborated-type-specifier is
ill-formed."

This sentence was added to honor NB comment US 41 via:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1131

Reply via email to