This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/45976] New: optional template keyword is not accepted by g++
- From: "mschulze at ivs dot cs.ovgu.de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Oct 2010 06:54:42 +0000
- Subject: [Bug c++/45976] New: optional template keyword is not accepted by g++
- Auto-submitted: auto-generated
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â