This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/13924] New: #include<vector> imports partial definition of std::abs
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jan 2004 20:43:31 -0000
- Subject: [Bug libstdc++/13924] New: #include<vector> imports partial definition of std::abs
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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