This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15839] New: Requires definition of literal passed as const reference
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jun 2004 04:33:41 -0000
- Subject: [Bug c++/15839] New: Requires definition of literal passed as const reference
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Also, the linker data seems generally wrong because the file/line number in the linker message do not reference the point of problem.
The problem is at powerset.hh:685:
return lower_bound(TypeTraits<E>::lwb);
TypeTraits<E>::lwb is a manifest constant with value 0x8000 (the smallest short), and lower_bound is declared and defined as:
iterator lower_bound(const key_type&) const;
The compiler should pass the constant as a temporary, and does so for other calls of lower_bound, e.g. at testPowerset.cc:230 -
Assert(*pie.lower_bound(7) == 7);
However, in this case the generated code causes the linker to want a definition so it can build a pointer. If the problematic call is replaced with:
E e = TypeTraits<E>::lwb;
return lower_bound(e);
the linker error goes away.
I have tried to reduce the case but cannot get it to fail.
Attached are compiler output, source code, and a static library needed to link.
Ivan
--
Summary: Requires definition of literal passed as const reference
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=15839