This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/45964] New: The compiler does not complain about a required template keyword.
- 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: Mon, 11 Oct 2010 09:18:48 +0000
- Subject: [Bug c++/45964] New: The compiler does not complain about a required template keyword.
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45964
Summary: The compiler does not complain about a required
template keyword.
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mschulze@ivs.cs.ovgu.de
Between version 4.2 and 4.4 the compiler changed in a way that it does not
complain about a required template keyword. In the following example IMO the
template keyword is required (C++-standard 14.2 in paragraph 4 and 5).
template<int a>
struct A {
template<int b>
struct B {
static const int value;
private:
struct C {
enum {value=10};
};
};
};
template<int a>
template<int b>
const int A< a>::B<b>::template value = A<a>::B<b>::C::value;
Since gcc 4.4 the code is accepted as it is. Older compilers reject it with the
error message "tp.cc:15: error: â::Câ has not been declared"
If I change the last code line to
const int A< a>::B<b>::template value = A<a>::template B<b>::C::value;
which is in my understanding the correct one, then the older compiler is also
satisfied. What drives me crazy, is that the new compiler works with this line
too. However, if I interpret the standard correct, the template keyword is not
optional here because "C" depends on a template parameter, and therewith the
template keyword is required.