2017-07-06 6 views
1

はブースト1.64とGCC 4.9.2でコンパイルに失敗します。私は、それが合法だと思いながらコンパイルは、ネストされたブーストのために失敗した::コードに続いて融合ペアの変種

#include <boost/fusion/support/pair.hpp> 
#include <boost/mpl/int.hpp> 
#include <boost/variant.hpp> 

#include <string> 

namespace bf = boost::fusion; 
namespace bm = boost::mpl; 

int 
main(int argc, char** argv) 
{ 
    using L2_t = boost::variant<bf::pair<bm::int_<1>,char>>; 
    using L1_t = boost::variant<bf::pair<bm::int_<1>,L2_t>>; 
    L1_t result; 
} 

エラーメッセージで始まります。私は彼らが異なるようにするためにペアのキー値の1つを変更するとき

/home/vagrant/.conan/data/boost/1.64.0/conaned/master/package/b06f2a498643ee1d889c6aea8e0e21d3cac9f57c/include/boost/fusion/support/pair.hpp: In instantiation of ‘constexpr boost::fusion::pai 
r<First, Second>::pair(const boost::fusion::pair<First, Second2>&) [with Second2 = boost::variant<boost::fusion::pair<mpl_::int_<1>, char> >; First = mpl_::int_<1>; Second = char]’:   /home/vagrant/.conan/data/boost/1.64.0/conaned/master/package/b06f2a498643ee1d889c6aea8e0e21d3cac9f57c/include/boost/type_traits/is_constructible.hpp:33:45: required by substitution of ‘tem 
plate<class T, class Arg, class> static boost::type_traits::yes_type boost::detail::is_constructible_imp::test1(int) [with T = boost::fusion::pair<mpl_::int_<1>, char>; Arg = const boost::fus 
ion::pair<mpl_::int_<1>, boost::variant<boost::fusion::pair<mpl_::int_<1>, char> > >&; <template-parameter-1-3> = <missing>]’ 

コンパイルが成功しました。

この問題を解決するにはどうすればよいですか?私はそれらのペアのキーの値をシリアル化/デシリアライズするために使用するので、それらを異なるレベルで同じ値にすることが私にとって重要です。

+1

gcc 5.2で動作するようです:https://wandbox.org/permlink/o4IpZbyohgECH7kO – xaxxon

+0

右!オンライン編集について思い出してくれてありがとう、私は忘れてしまった。それはそこにチェックしないで愚かだった。 –

+0

変更ログ(特にどのバグが解決されたか)を見ると、4.9やそれ以前のバージョンでは多くのC++ 11バグが修正されています。いくつかの欠落した機能さえも実装されています。完全な例を投稿していただき、ありがとうございます。この例では、オンラインコンパイラにコピー/ペーストすることは簡単です。 – xaxxon

答えて

1

xaxxonによると、これはgcc 5.2から始まります。

関連する問題