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

            Bug ID: 89873
           Summary: internal compiler error: unexpected expression of kind
                    implicit_conv_expr
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Split out of <https://gcc.gnu.org/ml/gcc-patches/2019-03/msg01379.html>.

// { dg-do compile { target c++14 } }

template <int> bool b;

template <typename> 
struct C {
  template <typename> friend int foo() noexcept(b<1>); // { dg-error "not
usable in a constant expression|different exception specifier" }
};

template <typename> int foo() noexcept(b<1>);

auto a = C<int>();

$ ./cc1plus -quiet noexcept1.C
noexcept1.C: In instantiation of ‘int foo()’:
noexcept1.C:7:34:   required from ‘struct C<int>’
noexcept1.C:12:17:   required from here
noexcept1.C:7:34: internal compiler error: unexpected expression ‘b<1>’ of kind
implicit_conv_expr
    7 |   template <typename> friend int foo() noexcept(b<1>); // { dg-error
"not usable in a constant expression|different exception specifier" }
      |                                  ^~~
0x8ecf05 cxx_eval_constant_expression
        /home/mpolacek/src/gcc/gcc/cp/constexpr.c:5207
0x8ed7d8 cxx_eval_outermost_constant_expr
        /home/mpolacek/src/gcc/gcc/cp/constexpr.c:5322
0x8ee06b cxx_constant_value(tree_node*, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/constexpr.c:5445
0x9b3530 build_noexcept_spec(tree_node*, int)
        /home/mpolacek/src/gcc/gcc/cp/except.c:1292
0xb0c359 maybe_instantiate_noexcept(tree_node*, int)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:24274
0x93316e check_redeclaration_exception_specification
        /home/mpolacek/src/gcc/gcc/cp/decl.c:1157
0x93a793 duplicate_decls(tree_node*, tree_node*, bool)
        /home/mpolacek/src/gcc/gcc/cp/decl.c:2078
0xa1bc0a do_pushdecl
        /home/mpolacek/src/gcc/gcc/cp/name-lookup.c:3034
0xa1c611 pushdecl(tree_node*, bool)
        /home/mpolacek/src/gcc/gcc/cp/name-lookup.c:3162
0xa1eb16 do_pushdecl_with_scope
        /home/mpolacek/src/gcc/gcc/cp/name-lookup.c:3900
0xa23319 pushdecl_namespace_level(tree_node*, bool)
        /home/mpolacek/src/gcc/gcc/cp/name-lookup.c:5091
0xac8e40 tsubst_friend_function
        /home/mpolacek/src/gcc/gcc/cp/pt.c:10417
0xacdac8 instantiate_class_template_1
        /home/mpolacek/src/gcc/gcc/cp/pt.c:11404
0xacdd20 instantiate_class_template(tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:11469
0xb976b1 complete_type(tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/typeck.c:138
0xb976d6 complete_type_or_maybe_complain(tree_node*, tree_node*, int)
        /home/mpolacek/src/gcc/gcc/cp/typeck.c:150
0xbc8b21 build_functional_cast(tree_node*, tree_node*, int)
        /home/mpolacek/src/gcc/gcc/cp/typeck2.c:2272
0xa6ba2b cp_parser_functional_cast
        /home/mpolacek/src/gcc/gcc/cp/parser.c:28373
0xa40cd4 cp_parser_postfix_expression
        /home/mpolacek/src/gcc/gcc/cp/parser.c:7098
0xa4453f cp_parser_unary_expression
        /home/mpolacek/src/gcc/gcc/cp/parser.c:8469
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