Boost logo

Boost Users :

Subject: [Boost-users] Boost 1.42 TR1 With GCC 4.5 selects wrong overload
From: Abir Basak (abirbasak_at_[hidden])
Date: 2011-01-13 02:42:28


I am using the portable style boost headers for tr1 implementation from
Boost 1.42 such as #include <boost/tr1/type_traits.hpp>

When i use gcc implementation of tr1 (Mingw GCC 4.5.1 from TDM,
BOOST_HAS_GCC_TR1 defined) everything works fine.
However when i select boost tr1 implementation (i.e not define the above
macro) some stdlib functions such as std::abs gets
wrong overloaded selected. For. e.g. in gcc/tr1 std::abs((signed char)5)
returns an int while in boost/tr1 it returns a double.

A compilable example is like
#include <cstdlib>
#include <iostream>
#include <typeinfo>
#include <boost/tr1/type_traits.hpp>
int main(){
    std::cout<<typeid(std::abs((short)5)).name();
    //prints i with gcc/tr1 while prints d with boost/tr1
}

it happens with type_traits header (may be few other also) but not with all
tr1 headers(such as array).

Thank you.
abir basak



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net