This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11811] New: Weird error message with default template arguments
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Aug 2003 18:33:40 -0000
- Subject: [Bug c++/11811] New: Weird error message with default template arguments
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11811
Summary: Weird error message with default template arguments
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bangerth at dealii dot org
CC: gcc-bugs at gcc dot gnu dot org,gdr at gcc dot gnu dot
org
Consider the following code:
-------------------------
void foo(int);
template <typename>
void bar() {
foo;
}
template void bar<int>();
--------------------------
With present mainline, we get the following message:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `void bar() [with <template default argument error> = int]':
x.cc:8: instantiated from here
x.cc:5: warning: statement is a reference, not call, to function `foo(int)'
Note the string "<template default argument error>". That's weird,
because the error is certainly not in the default argument. It
seems to me as if the expression dumper just has a problem here,
but I better leave this judgement to those who know better.
Another weird point: if one removes the declaration of foo(), i.e.
--------------------------------
template <typename>
void bar() {
foo;
}
template void bar<int>();
--------------------------------
then we get a message that doesn't even say that bar is a template:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `void bar()':
x.cc:3: error: `foo' undeclared (first use this function)
x.cc:3: error: (Each undeclared identifier is reported only once for each
function it appears in.)
That's at best inconsistent.
W.