This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16071] New: Bad error message
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jun 2004 23:55:03 -0000
- Subject: [Bug c++/16071] New: Bad error message
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In:
#include <iostream>
class A{};
template<typename T>
void Baz(const T& t) {}
void Baz(const A& i) {}
int main() {
A a;
Baz(std::endl);
}
you get:
~/ootbc/common/test/src$ g++ foo1.cc
foo1.cc: In function `int main()':
foo1.cc:10: error: invalid initialization of reference of type 'const A&' from expression of type '<unknown type>'
foo1.cc:6: error: in passing argument 1 of `void Baz(const A&)'
The actual bug is an ambiguous overload resolution because endl is an overloaded function, and you should get a standard ambiguity message cascad listing the candidate resolutions. "unknown type" is lame; at worst you should list the possible types when there are more than one. And it appears that the compiler is attempting to invode the "void Baz(const A& i) {}" overload, which does not match *any* of the candidates as all eligable ambiguities are on the other (templated) overload.
Ivan
--
Summary: Bad error message
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=16071