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

            Bug ID: 61975
           Summary: default template arguments do not work with
                    out-of-class class declaration
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vanyacpp at gmail dot com

GCC shows error on this code:

template <typename T>
struct x
{
    template <typename U>
    struct y;
};


template <>
template <typename U = int>
struct x<int>::y
{
    typedef U type;
};

x<int>::y<>::type a;

2.cpp:17:11: error: wrong number of template arguments (0, should be 1)
 x<int>::y<>::type a;
           ^
2.cpp:5:12: error: provided for ‘template<class U> struct x<int>::y<U>’
     struct y;
            ^
2.cpp:17:19: error: expected initializer before ‘a’
 x<int>::y<>::type a;
                   ^

I think this code is correct because default argument for parameter U is
specified. Clang compiles this code correctly.

Reply via email to