public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15839] New: Requires definition of literal passed as const reference
@ 2004-06-06 4:33 igodard at pacbell dot net
2004-06-06 4:34 ` [Bug c++/15839] " igodard at pacbell dot net
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: igodard at pacbell dot net @ 2004-06-06 4:33 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15839] Requires definition of literal passed as const reference
2004-06-06 4:33 [Bug c++/15839] New: Requires definition of literal passed as const reference igodard at pacbell dot net
@ 2004-06-06 4:34 ` igodard at pacbell dot net
2004-06-06 4:36 ` igodard at pacbell dot net
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: igodard at pacbell dot net @ 2004-06-06 4:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From igodard at pacbell dot net 2004-06-06 04:34 -------
Created an attachment (id=6479)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6479&action=view)
Compiler output (-v -save-temps)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15839
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15839] Requires definition of literal passed as const reference
2004-06-06 4:33 [Bug c++/15839] New: Requires definition of literal passed as const reference igodard at pacbell dot net
2004-06-06 4:34 ` [Bug c++/15839] " igodard at pacbell dot net
@ 2004-06-06 4:36 ` igodard at pacbell dot net
2004-06-06 4:37 ` igodard at pacbell dot net
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: igodard at pacbell dot net @ 2004-06-06 4:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From igodard at pacbell dot net 2004-06-06 04:36 -------
Created an attachment (id=6480)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6480&action=view)
Source code (-save-temps)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15839
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15839] Requires definition of literal passed as const reference
2004-06-06 4:33 [Bug c++/15839] New: Requires definition of literal passed as const reference igodard at pacbell dot net
2004-06-06 4:34 ` [Bug c++/15839] " igodard at pacbell dot net
2004-06-06 4:36 ` igodard at pacbell dot net
@ 2004-06-06 4:37 ` igodard at pacbell dot net
2004-06-06 4:45 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: igodard at pacbell dot net @ 2004-06-06 4:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From igodard at pacbell dot net 2004-06-06 04:37 -------
Created an attachment (id=6481)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6481&action=view)
Library (to link app on x86)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15839
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15839] Requires definition of literal passed as const reference
2004-06-06 4:33 [Bug c++/15839] New: Requires definition of literal passed as const reference igodard at pacbell dot net
` (2 preceding siblings ...)
2004-06-06 4:37 ` igodard at pacbell dot net
@ 2004-06-06 4:45 ` pinskia at gcc dot gnu dot org
2004-06-06 5:23 ` igodard at pacbell dot net
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-06 4:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-06 04:44 -------
Invalid here is a reduced source:
struct t
{
static const int t1 = 1;
};
int g(const int&){}
int main()
{
g(t::t1);
}
The problem is that you do not define the static int any where(outside the class). Read bug 13259 for
more information as this is a dup of that bug.
Hint for the above testcase adding the following will work:
const int t::t1;
*** This bug has been marked as a duplicate of 13259 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15839
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15839] Requires definition of literal passed as const reference
2004-06-06 4:33 [Bug c++/15839] New: Requires definition of literal passed as const reference igodard at pacbell dot net
` (3 preceding siblings ...)
2004-06-06 4:45 ` pinskia at gcc dot gnu dot org
@ 2004-06-06 5:23 ` igodard at pacbell dot net
2004-06-06 6:32 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: igodard at pacbell dot net @ 2004-06-06 5:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From igodard at pacbell dot net 2004-06-06 05:23 -------
If the code is in fact invalid, then please re-open this as a bug where the nostic location info reported by the linker bears no relation to the point of error
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|DUPLICATE |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15839
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15839] Requires definition of literal passed as const reference
2004-06-06 4:33 [Bug c++/15839] New: Requires definition of literal passed as const reference igodard at pacbell dot net
` (4 preceding siblings ...)
2004-06-06 5:23 ` igodard at pacbell dot net
@ 2004-06-06 6:32 ` pinskia at gcc dot gnu dot org
2005-04-28 2:05 ` pinskia at gcc dot gnu dot org
2005-04-28 2:07 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-06 6:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-06 06:32 -------
Here is the reduced source for the linker problem:
struct t
{
static const int t1 = 1;
};
int g(const int&){}
template <class T>
int f()
{
return g(t::t1);
}
int main()
{
f<int>();
}
It shows line 15 when it should show 11.
I looked at the debuging info and this is not a gcc bug but rather a binutils (ld is part of that project)
bug so please report it to them, http://sources.redhat.com/bugzilla/
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15839
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15839] Requires definition of literal passed as const reference
2004-06-06 4:33 [Bug c++/15839] New: Requires definition of literal passed as const reference igodard at pacbell dot net
` (5 preceding siblings ...)
2004-06-06 6:32 ` pinskia at gcc dot gnu dot org
@ 2005-04-28 2:05 ` pinskia at gcc dot gnu dot org
2005-04-28 2:07 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-28 2:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-28 02:04 -------
Mark as a dup of bug 14404.
*** This bug has been marked as a duplicate of 14404 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15839
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/15839] Requires definition of literal passed as const reference
2004-06-06 4:33 [Bug c++/15839] New: Requires definition of literal passed as const reference igodard at pacbell dot net
` (6 preceding siblings ...)
2005-04-28 2:05 ` pinskia at gcc dot gnu dot org
@ 2005-04-28 2:07 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-28 2:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-28 02:03 -------
Reopening to ...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15839
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-04-28 2:05 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-06 4:33 [Bug c++/15839] New: Requires definition of literal passed as const reference igodard at pacbell dot net
2004-06-06 4:34 ` [Bug c++/15839] " igodard at pacbell dot net
2004-06-06 4:36 ` igodard at pacbell dot net
2004-06-06 4:37 ` igodard at pacbell dot net
2004-06-06 4:45 ` pinskia at gcc dot gnu dot org
2004-06-06 5:23 ` igodard at pacbell dot net
2004-06-06 6:32 ` pinskia at gcc dot gnu dot org
2005-04-28 2:05 ` pinskia at gcc dot gnu dot org
2005-04-28 2:07 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).