[Bug c++/20313] New: poor diagnostic
igodard at pacbell dot net
gcc-bugzilla@gcc.gnu.org
Fri Mar 4 09:25:00 GMT 2005
In:
template<int> struct s1{ s1(int); };
template<int i> s1<i>::s1(int j){}
template<int> struct s;
template<> struct s<0> { s(int); };
template<> struct s<1> { s(int); };
template<int i> s<i>::s(int j) {}
int main() {
s<0> a(5);
s1<0> b(5);
}
you get:
~/ootbc/members/src$ g++ foo.cc
foo.cc:10: error: invalid use of undefined type `struct s<<anonymous> >'
foo.cc:5: error: declaration of `struct s<<anonymous> >'
foo.cc:10: error: template definition of non-template `s<<anonymous> >::s(int)'
This had me mystified enough that I had to reduce my code to this example and
try it on Comeau, which gives:
Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict errors C++
"ComeauTest.c", line 10: error: incomplete type is not allowed
template<int i> s<i>::s(int j) {}
^
"ComeauTest.c", line 10: error: template argument list must match the parameter list
template<int i> s<i>::s(int j) {}
^
2 errors detected in the compilation of "ComeauTest.c".
With that I saw what my problem was. The gcc diagnostic might be obvious to
everyone but me, but I doubt it.
Ivan
--
Summary: poor 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=20313
More information about the Gcc-bugs
mailing list