https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82531
Bug ID: 82531 Summary: ICE: Segmentation fault (-std=c++1z -fconcepts) Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc-bugs at deta dot lv Target Milestone: --- Got ICE while experimenting with concepts. The code is definitely no longer valid after passing through creduce, but ICE is the same. ==== g++ -v ---- Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local-gcc-7.2/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --enable-languages=c,c++,lto --enable-multilib Thread model: posix gcc version 7.2.0 (GCC) ==== command: ---- g++ -std=c++1z -fconcepts -c testcase.cpp ==== compiler output: ---- testcase.cpp: In instantiation of ‘auto operator-(auto:2, auto:2) [with auto:2 = tuple<>]’: testcase.cpp:16:13: required from here testcase.cpp:12:47: internal compiler error: Segmentation fault auto operator-(tuple_type, tuple_type u) { map(u); } ~~~^~~ 0xb127af crash_signal ../../gcc/toplev.c:337 0x613e10 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.c:13561 0x61e4b2 tsubst_template_args ../../gcc/cp/pt.c:11779 0x62714c tsubst_aggr_type ../../gcc/cp/pt.c:11981 0x614438 tsubst(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.c:13487 0x6254e6 tsubst_qualified_id ../../gcc/cp/pt.c:14373 0x61f279 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../../gcc/cp/pt.c:16962 0x618b37 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../gcc/cp/pt.c:16550 0x71bbea satisfy_predicate_constraint ../../gcc/cp/constraint.cc:2016 0x71bbea satisfy_constraint_1 ../../gcc/cp/constraint.cc:2244 0x71be44 satisfy_check_constraint ../../gcc/cp/constraint.cc:2061 0x71be44 satisfy_constraint_1 ../../gcc/cp/constraint.cc:2247 0x71c1d0 satisfy_constraint ../../gcc/cp/constraint.cc:2302 0x71c2c3 satisfy_associated_constraints ../../gcc/cp/constraint.cc:2326 0x71c3c3 constraints_satisfied_p(tree_node*) ../../gcc/cp/constraint.cc:2401 0x5de5b9 add_function_candidate ../../gcc/cp/call.c:2072 0x5df0d9 add_template_candidate_real ../../gcc/cp/call.c:3208 0x5d6844 add_template_candidate ../../gcc/cp/call.c:3252 0x5d6844 add_candidates ../../gcc/cp/call.c:5483 0x5e0cc1 perform_overload_resolution ../../gcc/cp/call.c:4143 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. ==== reduced test case (testcase.cpp) ---- typedef int size_t; template <typename _Tp, _Tp __v> struct integral_constant { static constexpr _Tp value = __v; }; typedef integral_constant<bool, true> true_type; template <typename...> class tuple {}; template <typename> struct is_tuple : true_type {}; template <class T> concept bool tuple_type = is_tuple<T>::value; template <typename FUN> decltype() map(FUN, tuple_type... tuples); auto operator-(tuple_type, tuple_type u) { map(u); } using quantity = tuple<>; constexpr quantity foo(quantity const& L, quantity const& R){ return R - L; } ==== I hope this helps.