https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89024

            Bug ID: 89024
           Summary: ICE testing convertibility of incomplete enumeration
                    types
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Reduced:

template<class T> T&& declval();

template<typename _To1>
void __test_aux(_To1);

template<typename _From1, typename _To1,
        typename = decltype(__test_aux<_To1>(declval<_From1>()))>
char __test(int);

template<typename, typename>
int __test(...);

enum E {
    x = decltype(__test<E, int>(0))(0);
};

prog.cc: In substitution of 'template<class _From1, class _To1, class> char
__test(int) [with _From1 = E; _To1 = int; <template-parameter-1-3> =
<missing>]':
prog.cc:14:34:   required from here
prog.cc:7:45: internal compiler error: Segmentation fault
    7 |         typename = decltype(__test_aux<_To1>(declval<_From1>()))>
      |                             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
0xb80c8f crash_signal
        ../../source/gcc/toplev.c:326
0x61d43e type_promotes_to(tree_node*)
        ../../source/gcc/cp/cvt.c:1916
0x5df449 standard_conversion
        ../../source/gcc/cp/call.c:1418
0x5e541b implicit_conversion
        ../../source/gcc/cp/call.c:1865
0x5e664a add_function_candidate
        ../../source/gcc/cp/call.c:2255
0x5e7045 add_template_candidate_real
        ../../source/gcc/cp/call.c:3284
0x5e7574 add_template_candidate
        ../../source/gcc/cp/call.c:3325
0x5e7574 add_candidates
        ../../source/gcc/cp/call.c:5618
0x5e7933 add_candidates
        ../../source/gcc/cp/call.c:4284
0x5e7933 perform_overload_resolution
        ../../source/gcc/cp/call.c:4292
0x5eb045 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../source/gcc/cp/call.c:4366
0x6fd760 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../source/gcc/cp/semantics.c:2568
0x6d43ed tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../source/gcc/cp/pt.c:18874
0x6dbd8c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../source/gcc/cp/pt.c:14991
0x6dbd8c tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../source/gcc/cp/pt.c:14991
0x6e8ff2 type_unification_real
        ../../source/gcc/cp/pt.c:20874
0x6e9b80 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ../../source/gcc/cp/pt.c:20066
0x5e6e20 add_template_candidate_real
        ../../source/gcc/cp/call.c:3240
0x5e7574 add_template_candidate
        ../../source/gcc/cp/call.c:3325
0x5e7574 add_candidates
        ../../source/gcc/cp/call.c:5618
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.

Reply via email to