* Fail to compile Boost make_shared when -std=c++0x on
@ 2010-11-28 3:38 陳韋任
2010-11-28 11:49 ` Marc Glisse
0 siblings, 1 reply; 3+ messages in thread
From: 陳韋任 @ 2010-11-28 3:38 UTC (permalink / raw)
To: gcc-help
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.)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fail to compile Boost make_shared when -std=c++0x on
2010-11-28 3:38 Fail to compile Boost make_shared when -std=c++0x on 陳韋任
@ 2010-11-28 11:49 ` Marc Glisse
2010-11-28 20:00 ` 陳韋任
0 siblings, 1 reply; 3+ messages in thread
From: Marc Glisse @ 2010-11-28 11:49 UTC (permalink / raw)
To: 陳韋任; +Cc: gcc-help
On Sun, 28 Nov 2010, é³éä»» wrote:
> 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:
[...]
> And here are gcc versions:
>
> g++46 (GCC) 4.6.0 20101023 (experimental)
> g++45 (GCC) 4.5.2 20101021 (prerelease)
>
> Any suggestion appreciated.
Hello,
just upgrade to a newer version of boost. I can't tell when it was fixed
exactly, but at least the current svn works fine. This is most likely due
to the change in binding lvalues to rvalue references.
C++0X support is a moving target in both g++ and boost. The version of
boost you are using was written for g++-4.4 (which itself was written for
the standard draft that was current at the time).
--
Marc Glisse
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fail to compile Boost make_shared when -std=c++0x on
2010-11-28 11:49 ` Marc Glisse
@ 2010-11-28 20:00 ` 陳韋任
0 siblings, 0 replies; 3+ messages in thread
From: 陳韋任 @ 2010-11-28 20:00 UTC (permalink / raw)
To: gcc-help
Hi, Marc
Thanks for the information. Many thanks. :)
Regards,
chenwj
--
Wei-Ren Chen (陳韋任)
Tel:886-2-2788-3799 #1667
Parallel Processing Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-28 11:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-28 3:38 Fail to compile Boost make_shared when -std=c++0x on 陳韋任
2010-11-28 11:49 ` Marc Glisse
2010-11-28 20:00 ` 陳韋任
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).