Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
crashing gcc 6.2 boost 1.62
crash.cc:16:27: warning: unused parameter 'first' [-Wunused-parameter]
static Tree Create(Iter first, Iter last) { return Leaf{}; }
^
crash.cc:16:39: warning: unused parameter 'last' [-Wunused-parameter]
static Tree Create(Iter first, Iter last) { return Leaf{}; }
^
In file included from crash.cc:4:
In file included from /home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant.hpp:17:
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:1732:52: error: no type named 'type' in 'boost::enable_if<boost::is_rvalue_reference<const Tree &>, void>'; 'enable_if' cannot be used to disable this declaration
variant(T&& operand, typename boost::enable_if<boost::is_rvalue_reference<T&&> >::type* = 0,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
crash.cc:13:19: note: in instantiation of member function 'boost::variant<Leaf, boost::recursive_wrapper<Node> >::variant' requested here
using TreeBase::TreeBase;
^
crash.cc:12:8: note: while substituting deduced template arguments into function template 'Tree' [with T = const Tree &]
struct Tree : TreeBase {
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/type_traits/is_nothrow_move_constructible.hpp:49:54: note: during template argument deduction for class template partial specialization 'false_or_cpp11_noexcept_move_constructible<type-parameter-0-0, typename enable_if_c<sizeof(T) && noexcept((T(::boost::declval<T>()))), void>::type>' [with T = boost::recursive_wrapper<Node>]
: public integral_constant<bool, ::boost::detail::false_or_cpp11_noexcept_move_constructible<T>::value>{};
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/mpl/aux_/has_type.hpp:20:1: note: in instantiation of template class 'boost::is_nothrow_move_constructible<boost::recursive_wrapper<Node> >' requested here
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_type, type, true)
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/mpl/has_xxx.hpp:245:65: note: expanded from macro 'BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF'
, boost::mpl::aux::type_wrapper<BOOST_MSVC_TYPENAME U::name>* = 0 \
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/mpl/aux_/has_type.hpp:20:1: note: while substituting deduced template arguments into function template 'test' [with U = boost::is_nothrow_move_constructible<boost::recursive_wrapper<Node> >]
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/mpl/has_xxx.hpp:253:18: note: expanded from macro 'BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF'
sizeof(gcc_3_2_wknd::test(static_cast<t_*>(0))) \
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/mpl/aux_/preprocessed/gcc/quote.hpp:36:20: note: (skipping 20 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
, aux::has_type< F<U1> >::value
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/mpl/iter_fold_if.hpp:102:20: note: in instantiation of member class 'boost::mpl::iter_fold_if<boost::mpl::l_item<mpl_::long_<2>, Leaf, boost::mpl::l_item<mpl_::long_<1>, boost::recursive_wrapper<Node>, boost::mpl::l_end> >, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::not_<boost::is_nothrow_move_constructible<mpl_::arg<1> > > >, 0>, mpl_::na, mpl_::na>::result_' requested here
typename result_::state
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/mpl/find_if.hpp:34:22: note: in instantiation of template class 'boost::mpl::iter_fold_if<boost::mpl::l_item<mpl_::long_<2>, Leaf, boost::mpl::l_item<mpl_::long_<1>, boost::recursive_wrapper<Node>, boost::mpl::l_end> >, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::not_<boost::is_nothrow_move_constructible<mpl_::arg<1> > > >, 0>, mpl_::na, mpl_::na>' requested here
typedef typename iter_fold_if<
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:228:34: note: in instantiation of template class 'boost::mpl::find_if<boost::mpl::l_item<mpl_::long_<2>, Leaf, boost::mpl::l_item<mpl_::long_<1>, boost::recursive_wrapper<Node>, boost::mpl::l_end> >, boost::mpl::not_<boost::is_nothrow_move_constructible<mpl_::arg<1> > > >' requested here
typedef typename boost::mpl::find_if<
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:1753:50: note: in instantiation of template class 'boost::detail::variant::is_variant_move_noexcept_constructible<boost::mpl::l_item<mpl_::long_<2>, Leaf, boost::mpl::l_item<mpl_::long_<1>, boost::recursive_wrapper<Node>, boost::mpl::l_end> > >' requested here
variant(variant&& operand) BOOST_NOEXCEPT_IF(variant_move_noexcept_constructible::type::value)
^
crash.cc:12:8: note: in instantiation of exception specification for 'variant' requested here
struct Tree : TreeBase {
^
In file included from crash.cc:4:
In file included from /home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant.hpp:17:
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:1735:9: error: call to member function 'convert_construct' is ambiguous
convert_construct( detail::variant::move(operand), 1L);
^~~~~~~~~~~~~~~~~
crash.cc:13:19: note: in instantiation of function template specialization 'boost::variant<Leaf, boost::recursive_wrapper<Node> >::variant<Tree>' requested here
using TreeBase::TreeBase;
^
crash.cc:28:27: note: in instantiation of function template specialization 'Tree::Create<__gnu_cxx::__normal_iterator<char *, std::basic_string<char> > >' requested here
const auto root = Tree::Create(begin(input), end(input));
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:1546:71: note: candidate function [with T = Tree]
typename boost::enable_if<boost::is_rvalue_reference<T&&> >::type convert_construct(
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:1670:10: note: candidate function [with U0 = Leaf, UN = <boost::recursive_wrapper<Node>>]
void convert_construct(
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:1660:10: note: candidate function [with U0 = Leaf, UN = <boost::recursive_wrapper<Node>>]
void convert_construct(
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:1651:10: note: candidate function [with U0 = Leaf, UN = <boost::recursive_wrapper<Node>>] not viable: no known conversion from 'typename ::boost::move_detail::remove_reference<Tree &>::type' (aka 'Tree') to 'boost::variant<Leaf, recursive_wrapper<Node> > &' for 1st argument
void convert_construct(
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:1525:10: note: candidate function [with T = Tree] not viable: expects an l-value for 1st argument
void convert_construct(
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:1567:10: note: candidate function template not viable: requires 3 arguments, but 2 were provided
void convert_construct(
^
/home/daniel/llvm-dev-3.8-env/boost-dev-1-60/include/boost/variant/variant.hpp:1581:77: note: candidate function template not viable: requires 3 arguments, but 2 were provided
typename boost::enable_if<boost::is_rvalue_reference<Variant&&> >::type convert_construct(
^
2 warnings and 2 errors generated.
#include <string>
#include <iterator>
#include <boost/variant.hpp>
struct Leaf { };
struct Node;
using TreeBase = boost::variant<Leaf, boost::recursive_wrapper<Node>>;
struct Tree : TreeBase {
using TreeBase::TreeBase;
template <typename Iter>
static Tree Create(Iter first, Iter last) { return Leaf{}; }
};
struct Node {
Tree left, right;
};
int main() {
std::string input{"abracadabra"};
const auto root = Tree::Create(begin(input), end(input));
}
In file included from /home/daniel/gcc-dev-6.2/include/boost/config.hpp:61:0,
from /home/daniel/gcc-dev-6.2/include/boost/type_index.hpp:17,
from /home/daniel/gcc-dev-6.2/include/boost/variant/variant.hpp:21,
from /home/daniel/gcc-dev-6.2/include/boost/variant.hpp:17,
from crash.cc:4:
/home/daniel/gcc-dev-6.2/include/boost/type_traits/is_nothrow_move_constructible.hpp: In substitution of ‘template<class T> Tree::Tree(T&&) [with T = Tree]’:
/home/daniel/gcc-dev-6.2/include/boost/type_traits/is_nothrow_move_constructible.hpp:43:52: required from ‘struct boost::is_nothrow_move_constructible<boost::recursive_wrapper<Node> >’
/home/daniel/gcc-dev-6.2/include/boost/mpl/aux_/has_type.hpp:20:1: required by substitution of ‘template<class U> static char (& boost::mpl::aux::has_type<T, fallback_>::gcc_3_2_wknd::test(const volatile boost::mpl::aux::type_wrapper<U>*, boost::mpl::aux::type_wrapper<typename U::type>*))[2] [with U = boost::is_nothrow_move_constructible<boost::recursive_wrapper<Node> >]’
/home/daniel/gcc-dev-6.2/include/boost/mpl/aux_/has_type.hpp:20:1: required from ‘const bool boost::mpl::aux::has_type<boost::is_nothrow_move_constructible<boost::recursive_wrapper<Node> >, mpl_::bool_<true> >::value’
/home/daniel/gcc-dev-6.2/include/boost/mpl/aux_/has_type.hpp:20:1: required from ‘struct boost::mpl::aux::has_type<boost::is_nothrow_move_constructible<boost::recursive_wrapper<Node> >, mpl_::bool_<true> >’
/home/daniel/gcc-dev-6.2/include/boost/mpl/aux_/preprocessed/gcc/quote.hpp:32:36: required from ‘struct boost::mpl::quote1<boost::is_nothrow_move_constructible, mpl_::void_>::apply<boost::recursive_wrapper<Node> >’
/home/daniel/gcc-dev-6.2/include/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp:36:8: [ skipping 19 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/home/daniel/gcc-dev-6.2/include/boost/mpl/iter_fold_if.hpp:104:11: required from ‘struct boost::mpl::iter_fold_if<boost::mpl::l_item<mpl_::long_<2l>, Leaf, boost::mpl::l_item<mpl_::long_<1l>, boost::recursive_wrapper<Node>, boost::mpl::l_end> >, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::not_<boost::is_nothrow_move_constructible<mpl_::arg<1> > > >, 0>, mpl_::na, mpl_::na>’
/home/daniel/gcc-dev-6.2/include/boost/mpl/find_if.hpp:39:17: required from ‘struct boost::mpl::find_if<boost::mpl::l_item<mpl_::long_<2l>, Leaf, boost::mpl::l_item<mpl_::long_<1l>, boost::recursive_wrapper<Node>, boost::mpl::l_end> >, boost::mpl::not_<boost::is_nothrow_move_constructible<mpl_::arg<1> > > >’
/home/daniel/gcc-dev-6.2/include/boost/variant/variant.hpp:232:13: required from ‘struct boost::detail::variant::is_variant_move_noexcept_constructible<boost::mpl::l_item<mpl_::long_<2l>, Leaf, boost::mpl::l_item<mpl_::long_<1l>, boost::recursive_wrapper<Node>, boost::mpl::l_end> > >’
/home/daniel/gcc-dev-6.2/include/boost/variant/variant.hpp:1808:32: required from ‘boost::variant<T0, TN>::variant(boost::variant<T0, TN>&&) [with T0_ = Leaf; TN = {boost::recursive_wrapper<Node>}]’
crash.cc:13:19: required by substitution of ‘template<class T> Tree::Tree(T&&) [with T = Tree]’
crash.cc:28:58: required from here
/home/daniel/gcc-dev-6.2/include/boost/type_traits/is_nothrow_move_constructible.hpp:43:52: internal compiler error: in instantiate_template_1, at cp/pt.c:17391
typename ::boost::enable_if_c<sizeof(T) && BOOST_NOEXCEPT_EXPR(T(::boost::declval<T>()))>::type
^
0x6480e3 instantiate_template_1
../../gcc/cp/pt.c:17391
0x6480e3 instantiate_template(tree_node*, tree_node*, int)
../../gcc/cp/pt.c:17526
0x64ef1d fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
../../gcc/cp/pt.c:17885
0x604dcd add_template_candidate_real
../../gcc/cp/call.c:3089
0x60552c add_template_candidate
../../gcc/cp/call.c:3171
0x60552c add_candidates
../../gcc/cp/call.c:5353
0x605a64 build_new_method_call_1
../../gcc/cp/call.c:8304
0x605a64 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int)
../../gcc/cp/call.c:8500
0x6d4cce locate_fn_flags
../../gcc/cp/method.c:902
0x6d50da walk_field_subobs
../../gcc/cp/method.c:1303
0x6d5a15 synthesized_method_walk
../../gcc/cp/method.c:1554
0x6d622c implicitly_declare_fn(special_function_kind, tree_node*, bool, tree_node*, tree_node*)
../../gcc/cp/method.c:1837
0x6d706c lazily_declare_fn(special_function_kind, tree_node*)
../../gcc/cp/method.c:2182
0x6d8c47 lookup_fnfields_1(tree_node*, tree_node*)
../../gcc/cp/search.c:1663
0x6d8d2b lookup_fnfields_slot(tree_node*, tree_node*)
../../gcc/cp/search.c:1689
0x602c7b build_user_type_conversion_1
../../gcc/cp/call.c:3640
0x603390 implicit_conversion
../../gcc/cp/call.c:1863
0x603f59 reference_binding
../../gcc/cp/call.c:1711
0x60313c implicit_conversion
../../gcc/cp/call.c:1802
0x604828 add_function_candidate
../../gcc/cp/call.c:2121
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Owner

daniel-j-h commented Dec 1, 2016

Also crashing GCC 7 snapshot https://godbolt.org/g/sw14Gn

Owner

daniel-j-h commented Dec 12, 2016

Boost.Variant constructor inheritance ticketed upstream: https://svn.boost.org/trac/boost/ticket/12680

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment