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

            Bug ID: 94592
           Summary: ICE in non-type template parameter with constexpr
                    constructor
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pacoarjonilla at yahoo dot es
  Target Milestone: ---

GCC10 --std=c++20

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

struct A {
    constexpr A() {}
};

template <A> struct B { };

template<typename> void bar () {
    B<{}> var;
}

void fu() {
    bar<int>();
}

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


meta.cc: In instantiation of ‘struct B<((A)<brace-enclosed initializer
list>())>’:
meta.cc:37:11:   required from ‘void bar() [with <template-parameter-1-1> =
int]’
meta.cc:41:14:   required from here
meta.cc:34:23: internal compiler error: unexpected expression
‘(A)<brace-enclosed initializer list>()’ of kind implicit_conv_expr
   34 | template <A> struct B { };
      |                       ^
0x8c3f37 cxx_eval_constant_expression
        /home/paco/git/gcc/gcc/cp/constexpr.c:6301
0x8c4366 cxx_eval_outermost_constant_expr
        /home/paco/git/gcc/gcc/cp/constexpr.c:6502
0x8c8654 maybe_constant_value(tree_node*, tree_node*, bool, bool)
        /home/paco/git/gcc/gcc/cp/constexpr.c:6774
0x9f860c convert_nontype_argument
        /home/paco/git/gcc/gcc/cp/pt.c:7099
0x9f860c convert_template_argument
        /home/paco/git/gcc/gcc/cp/pt.c:8331
0x9f9893 coerce_template_parms
        /home/paco/git/gcc/gcc/cp/pt.c:8810
0xa1bf61 lookup_template_class_1
        /home/paco/git/gcc/gcc/cp/pt.c:9648
0xa1e363 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        /home/paco/git/gcc/gcc/cp/pt.c:10020
0xa1e363 tsubst_aggr_type
        /home/paco/git/gcc/gcc/cp/pt.c:13301
0xa0e44f tsubst_decl
        /home/paco/git/gcc/gcc/cp/pt.c:14294
0xa3079d instantiate_class_template_1
        /home/paco/git/gcc/gcc/cp/pt.c:11748
0xa31ab2 instantiate_class_template(tree_node*)
        /home/paco/git/gcc/gcc/cp/pt.c:12007
0xa77ff9 complete_type(tree_node*)
        /home/paco/git/gcc/gcc/cp/typeck.c:137
0xa0e70b tsubst_decl
        /home/paco/git/gcc/gcc/cp/pt.c:14415
0xa063e0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/paco/git/gcc/gcc/cp/pt.c:17768
0xa0449e tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/paco/git/gcc/gcc/cp/pt.c:17985
0xa01733 instantiate_decl(tree_node*, bool, bool)
        /home/paco/git/gcc/gcc/cp/pt.c:25509
0xa31d7b instantiate_pending_templates(int)
        /home/paco/git/gcc/gcc/cp/pt.c:25625
0x93b9f3 c_parse_final_cleanups()
        /home/paco/git/gcc/gcc/cp/decl2.c:4874
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