Fail to compile Boost make_shared when -std=c++0x on

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

  I don't know this is a bug or not. Here is the example code:

// test.cpp
#include <vector>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>

int main()
{
  using namespace boost;
  shared_ptr<std::vector<int> > x =
    make_shared<std::vector<int> >(10);
}

  I use g++45 and g++46 installed from ports on FreeBSD. Everything
is fine when I compile the code without any option. However, when I
turn the option "-std=c++0x" on, g++ give me the error messge below:

In file included from /usr/local/include/boost/make_shared.hpp:15:0,
                 from test.cpp:2:
/usr/local/include/boost/smart_ptr/make_shared.hpp: In function
'boost::shared_ptr<X> boost::make_shared(Args&& ...) [with T =
std::vector<int>, Args = int]':
test.cpp:9:38:   instantiated from here
/usr/local/include/boost/smart_ptr/make_shared.hpp:148:5: error: no
matching function for call to 'forward(int&)'
/usr/local/include/boost/smart_ptr/make_shared.hpp:90:40: note:
candidate is: template<class T> T&& boost::detail::forward(T&&)

  And here are gcc versions:

g++46 (GCC) 4.6.0 20101023 (experimental)
g++45 (GCC) 4.5.2 20101021 (prerelease)

  Any suggestion appreciated.

Regards,
chenwj

-- 
Wei-Ren Chen (ééä)
Tel:886-2-2788-3799 #1667
Parallel Processing Lab, Institute of Information Science,
  Academia Sinica, Taiwan (R.O.C.)



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux