https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67164
Bug ID: 67164 Summary: [6 Regression] ICE: tree check: expected class ‘expression’, have ‘exceptional’ (argument_pack_select) in tree_operand_check, at tree.h:3356 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: trippels at gcc dot gnu.org Target Milestone: --- % cat github_113.ii namespace std { template <typename _Tp> struct integral_constant { static constexpr _Tp value = 0; }; template <bool, typename, typename> struct conditional; template <typename...> struct __or_; template <typename _B1, typename _B2> struct __or_<_B1, _B2> : conditional<1, _B1, _B2> {}; template <typename...> struct __and_; template <typename _B1, typename _B2> struct __and_<_B1, _B2> : conditional<1, _B2, _B1> {}; template <typename> struct is_rvalue_reference; template <typename _Tp> struct is_reference : __or_<integral_constant<bool>, is_rvalue_reference<_Tp>>::type {}; template <typename _Tp> _Tp declval(); struct __do_is_direct_constructible_impl { template <typename _Tp, typename _Arg, typename = decltype(_Tp(declval<_Arg>()))> static integral_constant<bool> __test(int); }; template <typename _Tp, typename _Arg> struct __is_direct_constructible_impl : __do_is_direct_constructible_impl { decltype(__test<_Tp, _Arg>(0)) type; }; template <typename _Tp, typename _Arg> struct __is_direct_constructible_new_safe : __and_<int, __is_direct_constructible_impl<_Tp, _Arg>> {}; template <typename _Tp, typename _Arg> struct __is_direct_constructible_new : conditional<is_reference<_Tp>::value, int, __is_direct_constructible_new_safe<_Tp, _Arg>> {}; template <typename _Tp, typename _Arg> struct __is_direct_constructible : __is_direct_constructible_new<_Tp, _Arg>::type {}; template <typename...> struct __is_nary_constructible; template <typename _Tp, typename _Arg> struct __is_nary_constructible<_Tp, _Arg> : __is_direct_constructible<_Tp, _Arg> {}; template <typename _Tp, typename... _Args> struct is_constructible : __is_nary_constructible<_Tp, _Args...>::type {}; template <bool> struct enable_if; template <bool, typename _Iftrue, typename> struct conditional { typedef _Iftrue type; }; template <typename _Iftrue, typename _Iffalse> struct conditional<false, _Iftrue, _Iffalse> { typedef _Iffalse type; }; } namespace boost { namespace hana { template <bool> struct fast_and; template <typename... Xn> struct closure { template <typename... Yn, typename = std::enable_if< fast_and<std::is_constructible<Xn, Yn &&>::value...>::value>> closure(Yn...); template <typename... Yn, typename std::enable_if< fast_and<std::is_constructible<Yn>::value...>::value>::type> closure(closure<Yn...>); }; template <typename> struct make_impl; template <typename Datatype> struct make_t { template <typename... X> decltype(auto) operator()(X... x) { return make_impl<Datatype>::apply(x...); } }; template <typename Datatype> make_t<Datatype> make; struct Pair; auto make_pair = make<Pair>; struct Tuple; auto make_tuple = make<Tuple>; template <> struct make_impl<Tuple> { template <typename... Xs> static closure<Xs...> apply(Xs &&...); }; struct pair : closure<> { using closure::closure; }; template <> struct make_impl<Pair> { template <typename F, typename S> static pair apply(F, S); }; namespace struct_detail { template <typename Memptr, Memptr> struct member_ptr {}; template <int, typename> auto prepare_member_name_impl() {} template <int n, typename> auto prepare_member_name() { return prepare_member_name_impl<n, int>; } } } } struct Person { int Person; auto apply() { struct member_names; boost::hana::make_tuple(boost::hana::make_pair( boost::hana::struct_detail::prepare_member_name<0, member_names>(), boost::hana::struct_detail::member_ptr<decltype(&Person::Person), &Person::Person>{})); } }; % clang++ -std=c++14 -c github_113.ii % (gcc-5 rejects the testcase) % g++ -std=c++14 -c github_113.ii github_113.ii: In instantiation of ‘struct std::__is_direct_constructible_impl<boost::hana::pair&, boost::hana::closure<boost::hana::pair&>&&>’: github_113.ii:41:8: required from ‘struct std::is_constructible<boost::hana::pair&, boost::hana::closure<boost::hana::pair&>&&>’ github_113.ii:56:13: required by substitution of ‘template<class ... Yn, class> boost::hana::closure<Xn>::closure(Yn ...) [with Yn = boost::hana::closure<boost::hana::pair& >; <template-parameter-1-2> = <missing>]’ github_113.ii:67:43: required from ‘decltype(auto) boost::hana::make_t<Datatype>::operator()(X ...) [with X = {boost::hana::pair}; Datatype = boost::hana::Tuple]’ github_113.ii:100:67: required from here github_113.ii:24:29: error: no matching function for call to ‘std::__is_direct_constructible_impl<boost::hana::pair&, boost::hana::closure<boost::hana::pair&>&&>::__test(int) ’ decltype(__test<_Tp, _Arg>(0)) type; ^ github_113.ii:20:34: note: candidate: template<class _Tp, class _Arg, class> static std::integral_constant<bool> std::__do_is_direct_constructible_impl::__test(int) static integral_constant<bool> __test(int); ^ github_113.ii:20:34: note: template argument deduction/substitution failed: github_113.ii:19:13: error: invalid cast of an rvalue expression of type ‘boost::hana::closure<boost::hana::pair&>’ to type ‘boost::hana::pair&’ typename = decltype(_Tp(declval<_Arg>()))> ^ (trunk ICEs since r214396) % g++ -c github_113.ii github_113.ii: In substitution of ‘template<class ... Yn, typename std::enable_if<boost::hana::fast_and<std::is_constructible<Yn>::value ...>::value>::type <anonymous> > boost::hana::pair::pair(boost::hana::closure<Xs ...>) [with Yn = <missing>; typename std::enable_if<boost::hana::fast_and<std::is_constructible<Yn>::value ...>::value>::type <anonymous> = <missing>]’: github_113.ii:19:13: required by substitution of ‘template<class _Tp, class _Arg, class> static std::integral_constant<bool> std::__do_is_direct_constructible_impl::__test(int) [with _Tp = boost::hana::pair&; _Arg = boost::hana::closure<boost::hana::pair&>&&; <template-parameter-1-3> = <missing>]’ github_113.ii:24:29: required from ‘struct std::__is_direct_constructible_impl<boost::hana::pair&, boost::hana::closure<boost::hana::pair&>&&>’ github_113.ii:41:8: required from ‘struct std::is_constructible<boost::hana::pair&, boost::hana::closure<boost::hana::pair&>&&>’ github_113.ii:56:13: required by substitution of ‘template<class ... Yn, class> boost::hana::closure<Xn>::closure(Yn ...) [with Yn = boost::hana::closure<boost::hana::pair&>; <template-parameter-1-2> = <missing>]’ github_113.ii:67:43: required from ‘decltype(auto) boost::hana::make_t<Datatype>::operator()(X ...) [with X = {boost::hana::pair}; Datatype = boost::hana::Tuple]’ github_113.ii:100:67: required from here github_113.ii:19:13: internal compiler error: tree check: expected class ‘expression’, have ‘exceptional’ (argument_pack_select) in tree_operand_check, at tree.h:3356 typename = decltype(_Tp(declval<_Arg>()))> ^ 0x10d3fcb7 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.c:9550 0x101160e3 expr_check ../../gcc/gcc/tree.h:3027 0x101160e3 tree_operand_check ../../gcc/gcc/tree.h:3356 0x102387cb tree_operand_check ../../gcc/gcc/tree.h:2972 0x102387cb unify ../../gcc/gcc/cp/pt.c:19046 0x102360ab unify ../../gcc/gcc/cp/pt.c:19096 0x101167b3 try_class_unification ../../gcc/gcc/cp/pt.c:18100 0x102356db unify ../../gcc/gcc/cp/pt.c:19134 0x1023a96f unify_one_argument ../../gcc/gcc/cp/pt.c:17450 0x10230277 type_unification_real ../../gcc/gcc/cp/pt.c:17522 0x10241453 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool) ../../gcc/gcc/cp/pt.c:16969 0x1018b31b add_template_candidate_real ../../gcc/gcc/cp/call.c:3054 0x1018bf4f add_template_candidate ../../gcc/gcc/cp/call.c:3151 0x1018bf4f add_candidates ../../gcc/gcc/cp/call.c:5307 0x101875d3 build_user_type_conversion_1 ../../gcc/gcc/cp/call.c:3662 0x10187ffb implicit_conversion ../../gcc/gcc/cp/call.c:1853 0x1018981b reference_binding ../../gcc/gcc/cp/call.c:1701 0x10187e27 implicit_conversion ../../gcc/gcc/cp/call.c:1792 0x10191aef perform_direct_initialization_if_possible(tree_node*, tree_node*, bool, int) ../../gcc/gcc/cp/call.c:9570 0x10342c73 build_static_cast_1 ../../gcc/gcc/cp/typeck.c:6631 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.