public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous
@ 2004-01-31 11:52 debian-gcc at lists dot debian dot org
  2004-01-31 18:56 ` [Bug libstdc++/13943] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2004-01-31 11:52 UTC (permalink / raw)
  To: gcc-bugs

[forwarded from http://bugs.debian.org/228645]

on i486-linux, glibc-2.3.2 based.

---
#include <math.h>
#include <cstdlib>

using namespace std;

int foo() { return llabs(1); }
---

g++-3.3 blah.cc -c
blah.cc: In function `int foo()':
blah.cc:6: error: call of overloaded `llabs(int)' is ambiguous
/usr/include/stdlib.h:754: error: candidates are: long long int llabs(long long
   int)
/usr/include/c++/3.3/cstdlib:152: error:                 long long int
   __gnu_cxx::llabs(long long int)

This works in g++ 3.2, but not 3.3 and 3.4.
<vector> pulls in <cstdlib>, so using <math.h> and <vector> together causes
this problem.  That is, it's triggered even if you don't use the <cstdlib>
header: merely mixing vector with math.h triggers it, and it's impossible
to avoid math.h (as library headers often pull it in.)

This doesn't happen with other functions in cstdlib, such as abs().
Comments in /usr/include/c++/3.3/cstdlib indicate that it's intended to
work ("// Get rid of those macros defined in <stdlib.h> ...").

-- 
           Summary: call of overloaded `llabs(int)' is ambiguous
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
@ 2004-01-31 18:56 ` pinskia at gcc dot gnu dot org
  2004-02-02 23:16 ` bangerth at dealii dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-31 18:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-31 18:56 -------
Confirmed, most likely what needs to happen is to add a check to libstdc++'s configure for llabs.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-31 18:56:11
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
  2004-01-31 18:56 ` [Bug libstdc++/13943] " pinskia at gcc dot gnu dot org
@ 2004-02-02 23:16 ` bangerth at dealii dot org
  2005-05-21 23:26 ` g_bugz at zewt dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-02-02 23:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-02-02 23:16 -------
This is a duplicate of PR 13924. 
 
W. 

*** This bug has been marked as a duplicate of 13924 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
  2004-01-31 18:56 ` [Bug libstdc++/13943] " pinskia at gcc dot gnu dot org
  2004-02-02 23:16 ` bangerth at dealii dot org
@ 2005-05-21 23:26 ` g_bugz at zewt dot org
  2005-05-21 23:35 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: g_bugz at zewt dot org @ 2005-05-21 23:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From g_bugz at zewt dot org  2005-05-21 23:26 -------
(Awesome.  I spend ten minutes typing out a response, the tracker goes "you 
can't do that!", and I lose it all.  Only Debian gets their tracker right ...)

(Very old response, since the fact that this was closed was just forwarded to 
me through Debian earlier today.)

I believe the merge with 13924 was in error; it talks about partial 
definitions, which is unrelated to this problem (which does not go away if 
<cmath> is also included).  In this test case, abs() and labs() work fine; only 
llabs() (and, I think, other C99 math functions, eg. lldiv) fails.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
                   ` (2 preceding siblings ...)
  2005-05-21 23:26 ` g_bugz at zewt dot org
@ 2005-05-21 23:35 ` pinskia at gcc dot gnu dot org
  2005-05-21 23:35 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-21 23:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-21 23:34 -------
Reopening for now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
                   ` (3 preceding siblings ...)
  2005-05-21 23:35 ` pinskia at gcc dot gnu dot org
@ 2005-05-21 23:35 ` pinskia at gcc dot gnu dot org
  2005-05-22  9:15 ` pcarlini at suse dot de
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-21 23:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-21 23:35 -------
(In reply to comment #1)
> Confirmed, most likely what needs to happen is to add a check to libstdc++'s configure for llabs.
This again should happen.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
                   ` (4 preceding siblings ...)
  2005-05-21 23:35 ` pinskia at gcc dot gnu dot org
@ 2005-05-22  9:15 ` pcarlini at suse dot de
  2005-05-22  9:32 ` pcarlini at suse dot de
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2005-05-22  9:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-05-22 09:15 -------
Gaby, can you have a look? It seems to me that we should use the same approach
used in std_cmath.h for fpclassify & co. In particular, when _GLIBCXX_USE_C99
is defined - that explicitly checks for llabs and lldiv - do *not* open code
llabs and lldiv. Probably the open coding of the overloads abs(long long) and
div(long long, long long) should stay, however, as a straightforward extension
of 26.5/4 for long long.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pcarlini at suse dot de, gdr
                   |                            |at integrable-solutions dot
                   |                            |net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
                   ` (5 preceding siblings ...)
  2005-05-22  9:15 ` pcarlini at suse dot de
@ 2005-05-22  9:32 ` pcarlini at suse dot de
  2005-05-22 10:32 ` gdr at integrable-solutions dot net
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2005-05-22  9:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-05-22 09:32 -------
Same for strt* and the other functions. Also we should remember to add to the
acinclude check for c99_stdlib the functions strtoll and strtoull, currently
missing.

(PS. In the meanwhile, done a minimal check that the approach used in std_cmath
for the classification macros appear to work well also for llabs)

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pcarlini at suse dot de
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
                   ` (6 preceding siblings ...)
  2005-05-22  9:32 ` pcarlini at suse dot de
@ 2005-05-22 10:32 ` gdr at integrable-solutions dot net
  2005-05-22 21:20 ` pcarlini at suse dot de
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-05-22 10:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2005-05-22 10:32 -------
Subject: Re:  call of overloaded `llabs(int)' is ambiguous

"pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| Gaby, can you have a look?

Yup.  Just woke up and many people are awaiting in the TODO queue...

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
                   ` (7 preceding siblings ...)
  2005-05-22 10:32 ` gdr at integrable-solutions dot net
@ 2005-05-22 21:20 ` pcarlini at suse dot de
  2005-05-26 15:57 ` cvs-commit at gcc dot gnu dot org
  2005-09-07 10:56 ` pcarlini at suse dot de
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2005-05-22 21:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-05-22 21:20 -------
Actually, I have a much better idea, that I'm testing right now: no need for
complex template-based tricks (in this case, at variance with the case of
classification macros, we *know* the type of the arguments!): llabs and lldiv
are protected by _GLIBCXX_USE_C99, therefore in namespace __gnu_cxx we can
simply do 'using ::llabs' ;)

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
                   ` (8 preceding siblings ...)
  2005-05-22 21:20 ` pcarlini at suse dot de
@ 2005-05-26 15:57 ` cvs-commit at gcc dot gnu dot org
  2005-09-07 10:56 ` pcarlini at suse dot de
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-26 15:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-26 15:47 -------
Subject: Bug 13943

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	paolo@gcc.gnu.org	2005-05-26 15:46:48

Modified files:
	libstdc++-v3   : ChangeLog acinclude.m4 configure 
	libstdc++-v3/include/c_std: std_cstdlib.h 
Added files:
	libstdc++-v3/testsuite/26_numerics/cstdlib: 13943.cc 

Log message:
	2005-05-26  Paolo Carlini  <pcarlini@suse.de>
	
	PR libstdc++/13943
	* include/c_std/std_cstdlib.h: Do not open code llabs and lldiv,
	available when _GLIBCXX_USE_C99 is defined.
	* testsuite/26_numerics/cstdlib/13943.cc: New.
	
	* acinclude.m4 ([GLIBCXX_ENABLE_C99]): For completeness, check
	also strtoll and strtoull for ac_c99_stdlib.
	* configure: Regenerate.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.3016&r2=1.3017
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/acinclude.m4.diff?cvsroot=gcc&r1=1.313&r2=1.314
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/configure.diff?cvsroot=gcc&r1=1.438&r2=1.439
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/26_numerics/cstdlib/13943.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/c_std/std_cstdlib.h.diff?cvsroot=gcc&r1=1.10&r2=1.11



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libstdc++/13943] call of overloaded `llabs(int)' is ambiguous
  2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
                   ` (9 preceding siblings ...)
  2005-05-26 15:57 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-07 10:56 ` pcarlini at suse dot de
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2005-09-07 10:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-09-07 10:55 -------
Fixed for 4.1.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13943


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-09-07 10:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-31 11:52 [Bug libstdc++/13943] New: call of overloaded `llabs(int)' is ambiguous debian-gcc at lists dot debian dot org
2004-01-31 18:56 ` [Bug libstdc++/13943] " pinskia at gcc dot gnu dot org
2004-02-02 23:16 ` bangerth at dealii dot org
2005-05-21 23:26 ` g_bugz at zewt dot org
2005-05-21 23:35 ` pinskia at gcc dot gnu dot org
2005-05-21 23:35 ` pinskia at gcc dot gnu dot org
2005-05-22  9:15 ` pcarlini at suse dot de
2005-05-22  9:32 ` pcarlini at suse dot de
2005-05-22 10:32 ` gdr at integrable-solutions dot net
2005-05-22 21:20 ` pcarlini at suse dot de
2005-05-26 15:57 ` cvs-commit at gcc dot gnu dot org
2005-09-07 10:56 ` pcarlini at suse dot de

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).