public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/13924] New: #include<vector> imports partial definition of std::abs
@ 2004-01-29 20:43 reichelt at gcc dot gnu dot org
  2004-01-29 21:08 ` [Bug libstdc++/13924] " bangerth at dealii dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-01-29 20:43 UTC (permalink / raw)
  To: gcc-bugs

Compiling the following code snippet with gcc 3.4/mainline

======================================================
#include<vector>

double foo(double x)
{
    return std::abs(x);
}
======================================================

I get the following error message

xxx.cc: In function `double foo(double)':
xxx.cc:5: error: call of overloaded `abs(double&)' is ambiguous
<internal>:5: error: candidates are: int std::abs(int)
/home/Pakete/gcc/FARM/gcc-20031229/include/c++/3.3.3/cstdlib:119: error:        
            long int std::abs(long int)
/home/Pakete/gcc/FARM/gcc-20031229/include/c++/3.3.3/cstdlib:149: error:        
            long long int __gnu_cxx::abs(long long int)

Obviously <vector> only imports the integer version on std::abs.

(Previous versions compiled the code without error. I don't know whether
<vector> is allowed to include <cmath> as well, so I don't know whether
this behaviour is okay or not.)

Maybe this is actually an improvement towards a clean interface of
<vector>, but I still find it confusing that std::abs is imported
only partially.

-- 
           Summary: #include<vector> imports partial definition of std::abs
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2004-02-02 23:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-29 20:43 [Bug libstdc++/13924] New: #include<vector> imports partial definition of std::abs reichelt at gcc dot gnu dot org
2004-01-29 21:08 ` [Bug libstdc++/13924] " bangerth at dealii dot org
2004-01-29 23:08 ` gdr at integrable-solutions dot net
2004-01-29 23:28 ` bangerth at dealii dot org
2004-01-30  0:11 ` gdr at integrable-solutions dot net
2004-01-30  0:24 ` pinskia at gcc dot gnu dot org
2004-02-02 23:16 ` bangerth at dealii 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).