This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/13924] New: #include<vector> imports partial definition of std::abs


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]