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++/45976] New: optional template keyword is not accepted by g++


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: unassigned@gcc.gnu.org
        ReportedBy: mschulze@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;
                ^^^^^^^^
[mschulze@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â


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