Discussion:
[Boost-users] Trouble with std::forward and fusion vector using clang 3.4 and older library - is there a workaround?
Stan Blakey
2016-12-06 13:42:04 UTC
Permalink
I am trying to compile using clang 3.4 and -std=c++11.

With the -std=c++11 it compiles and runs without any issue.
With -std=c++11 I get

boost_1_60_0\boost/fusion/container/vector/vector.hpp:126:20: error: no
template named 'forward' in namespace 'std'; did you mean
'advance_detail::forward'?

return std::forward<result>(*advance_c<N>(begin(seq)));
and many similar errors.

I have tried all the boost

BOOST_NO_CXX11_HDR_ macros but not found one that resolves this issue.

I don't have any choice about compiler version or library version due to
other constraints.

Any suggestions appreciated,

Stan



*#include* <boost/fusion/tuple.hpp>

*#include* <boost/fusion/algorithm.hpp>

*#include* <string>

*#include <iostream>*

*using* *namespace* boost::fusion;

*struct* print

{

*template* <*typename* *T*>

*void* *operator()*(*const* *T* &t) *const*

{

std::cout << std::boolalpha << t << '\n';

}

};

*int* *main*()

{

*typedef* tuple<*int*, std::string, *bool*, *double*> tuple_type;

tuple_type t(10,"Boost", *true*, 3.14);

for_each(t, print());

}
Kohei Takahashi
2016-12-15 07:59:12 UTC
Permalink
Hi Stan,

Sorry for quite late reply.
Post by Stan Blakey
With the -std=c++11 it compiles and runs without any issue.
With -std=c++11 I get
Which line is correct?
Post by Stan Blakey
no template named 'forward' in namespace 'std'; did you mean
'advance_detail::forward'?
return std::forward<result>(*advance_c<N>(begin(seq)));
and many similar errors.
Which standard library (and its version) are you using?

If your standard library provides `std::forward` and it functions
normally, try `BOOST_NO_CXX11_CONSTEXPR`.

Kohei Takahashi
Stan Blakey
2016-12-15 11:42:35 UTC
Permalink
Hi Kohei,
Sorry it is without --std=c++11 that every thing is fine.
The boost code manages to solve not having std::forward when compiled
without the std=c++11 flag.

With --std=c++11 I get the compiler errors about missing std::forward.

I have tried all the boost macros that pertain to library features with
no success. I did at the option BOOST_NO_CXX11_CONSTEXPR and this doesn't
work either. The compiler is the full clang 3.4 and does support c++11
features such as constexpr. It is the library that is old.

std::printf("GLIBCXX: %d\n",__GLIBCXX__);

produces

GLIBCXX: 20070514

Below is the full source with all the macros I have on:

Stan


*#define* BOOST_NO_CXX11_HDR_TYPE_TRAITS

*#define* BOOST_NO_CXX11_HDR_ATOMIC

*#define* BOOST_NO_CXX11_HDR_ARRAY

*#define* BOOST_NO_CXX11_HDR_CHRONO

*#define* BOOST_NO_CXX11_HDR_CODECVT

*#define* BOOST_NO_CXX11_HDR_CONDITION_VARIABLE

*#define* BOOST_NO_CXX11_HDR_FORWARD_LIST

*#define* BOOST_NO_CXX11_HDR_FUNCTIONAL

*#define* BOOST_NO_CXX11_HDR_FUTURE

*#define* BOOST_NO_CXX11_HDR_INITIALIZER_LIST

*#define* BOOST_NO_CXX11_HDR_MUTEX

*#define* BOOST_NO_CXX11_HDR_RANDOM

*#define* BOOST_NO_CXX11_HDR_RATIO

*#define* BOOST_NO_CXX11_HDR_SYSTEM_ERROR

*#define* BOOST_NO_CXX11_HDR_THREAD

*#define* BOOST_NO_CXX11_HDR_TUPLE

*#define* BOOST_NO_CXX11_HDR_TYPEINDEX

*#define* BOOST_NO_CXX11_HDR_TYPE_TRAITS

*#define* BOOST_NO_CXX11_HDR_UNORDERED_MAP

*#define* BOOST_NO_CXX11_NUMERIC_LIMITS

*#define* BOOST_NO_CXX11_SMART_PTR

*#define* BOOST_NO_CXX11_STD_UNORDERED

*#define* BOOST_NO_CXX11_ADDRESSOF

*#define* BOOST_NO_CXX11_ALLOCATOR

*#define* BOOST_NO_CXX11_ATOMIC_SMART_PTR

*#undef* BOOST_FUSION_HAS_VARIADIC_VECTOR

*#include* <boost/fusion/tuple.hpp>

*#include* <boost/fusion/algorithm.hpp>

*#include* <string>

*#include* <iostream>

#include <cstdio>

*using* *namespace* boost::fusion;

*struct* print

{

*template* <*typename* *T*>

*void* *operator()*(*const* *T* &t) *const*

{

std::cout << std::boolalpha << t << '\n';

}

};

*int* *main*()

{

*#ifdef* __GLIBCPP__

std::printf("GLIBCPP: %d\n",__GLIBCPP__);

*#endif*

*#ifdef* __GLIBCXX__

std::printf("GLIBCXX: %d\n",__GLIBCXX__);

*#endif*

*typedef* tuple<*int*, std::string, *bool*, *double*> tuple_type;

tuple_type t(10,"Boost", *true*, 3.14);

for_each(t, print());

}
Post by Kohei Takahashi
Hi Stan,
Sorry for quite late reply.
With the -std=c++11 it compiles and runs without any issue.
With -std=c++11 I get
Which line is correct?
boost_1_60_0\boost/fusion/container/vector/vector.hpp:126:20: error: no
template named 'forward' in namespace 'std'; did you mean
'advance_detail::forward'?
return std::forward<result>(*advance_c<N>(begin(seq)));
and many similar errors.
Which standard library (and its version) are you using?
If your standard library provides `std::forward` and it functions
normally, try `BOOST_NO_CXX11_CONSTEXPR`.
Kohei Takahashi
_______________________________________________
Boost-users mailing list
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Kohei Takahashi
2016-12-16 01:03:11 UTC
Permalink
Hi Stan,
Post by Stan Blakey
I have tried all the boost macros that pertain to library features
with no success. I did at the option BOOST_NO_CXX11_CONSTEXPR and this
doesn't work either. The compiler is the full clang 3.4 and does
support c++11 features such as constexpr. It is the library that is old.
std::printf("GLIBCXX: %d\n",__GLIBCXX__);
produces
GLIBCXX: 20070514
Wow... It's gcc4.2.0...

OK, I think `BOOST_NO_CXX11_RVALUE_REFERENCES` will fix this issue (and
disable variadic fusion::vector).

Kohei
Stan Blakey
2016-12-16 01:47:20 UTC
Permalink
Kohei,
Yes that works. Thanks.
Stan
Post by Kohei Takahashi
Hi Stan,
I have tried all the boost macros that pertain to library features with
no success. I did at the option BOOST_NO_CXX11_CONSTEXPR and this doesn't
work either. The compiler is the full clang 3.4 and does support c++11
features such as constexpr. It is the library that is old.
std::printf("GLIBCXX: %d\n",__GLIBCXX__);
produces
GLIBCXX: 20070514
Wow... It's gcc4.2.0...
OK, I think `BOOST_NO_CXX11_RVALUE_REFERENCES` will fix this issue (and
disable variadic fusion::vector).
Kohei
_______________________________________________
Boost-users mailing list
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Loading...