This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16233] New: Bad diagnostic
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jun 2004 17:24:53 -0000
- Subject: [Bug c++/16233] New: Bad diagnostic
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
template<typename T> struct A {
template<typename U> void Foo(){} };
template<typename V>struct B {
void Bar(V* v) {
v->template Foo<int>();
v->Foo<int>();
}
};
int main() {
A<bool> a;
B<A<bool> > b;
b.Bar(&a);
}
gets you:
~/ootbc/common/test/src$ g++ foo.cc
foo.cc: In member function `void B<V>::Bar(V*)':
foo.cc:6: error: expected primary-expression before "int"
foo.cc:6: error: expected `;' before "int"
The actual problem is the missing explicit "template" qualification. Surely the compiler can recognize "<int>" as a template argument list in this case. I grant that templates with data elements cannot be recognized in such a context:
--
Summary: Bad diagnostic
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: igodard at pacbell dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16233