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

           Summary: optional template keyword is not accepted by g++
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: mschu...@ivs.cs.ovgu.de


In the following code snippet the underlined template keyword is optional, but
g++ states an error message and rejects the code.

template<int a>
struct A {
    static const int value;

    template<int b>
    struct B {
        static const int value;
    };
};

// should be accepted, B<b> is a template
template<int a>
template<int b>
const int A<a>::template B<b>::value = 0;
                ^^^^^^^^
[mschu...@teeth ~]$ cat tp3.cc 
template<int a>
struct A {
    static const int value;

    template<int b>
    struct B {
        static const int value;
    };
};

$ g++ -c tp.cc -o tp.o
tp.cc:14: error: template definition of non-template ‘const int
A<a>::B<b>::value’

Reply via email to