This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16106] New: Poor 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: 20 Jun 2004 23:46:41 -0000
- Subject: [Bug c++/16106] New: Poor error message
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
template<typename T>
struct A {
A(T& t = T()) : tt(t) {}
T& tt;
};
int main() {
A<int> a;
return 0;
}
gives:
~/ootbc/common/test/src$ g++ foo.cc
foo.cc: In function `int main()':
foo.cc:8: error: default argument for parameter of type `int&' has type `int'
A sample better message is:
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 3: error: initial value of reference to non-const must be an
lvalue
A(T& t = T()) : tt(t) {}
^
detected during instantiation of "A<T>::A(T &) [with T=int]" at line
8
1 error detected in the compilation of "ComeauTest.c".
--
Summary: Poor 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=16106