[Bug c++/84596] [8 Regression] internal compiler error: unexpected expression '(bool)c' of kind implicit_conv_expr (cxx_eval_constant_expression)

vegard.nossum at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Mar 3 20:27:00 GMT 2018


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

--- Comment #6 from Vegard Nossum <vegard.nossum at gmail dot com> ---
I see a similar ICE on r258221 using this test case:

template<int x>
struct a {
  constexpr int b() {
    int c;
    static_assert(c %= 1);
  }
};

Output:

$ xgcc -x c++ -S -
<stdin>: In member function 'constexpr int a<x>::b()':
<stdin>:5:21: error: non-constant condition for static assertion
<stdin>:5:21: internal compiler error: unexpected expression '(bool)c %=1' of
kind implicit_conv_expr
0xa3cfab cxx_eval_constant_expression
        /home/vegard/git/gcc/gcc/cp/constexpr.c:4770
0xa4de8a cxx_eval_outermost_constant_expr
        /home/vegard/git/gcc/gcc/cp/constexpr.c:4830
0x12a6a7d finish_static_assert(tree_node*, tree_node*, unsigned int, bool)
        /home/vegard/git/gcc/gcc/cp/semantics.c:8678
0xed0a31 cp_parser_static_assert
        /home/vegard/git/gcc/gcc/cp/parser.c:13947
0xfb0b11 cp_parser_block_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12877
0xfb2094 cp_parser_declaration_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:12474
0xefef9b cp_parser_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:10923
0xf02a5b cp_parser_statement_seq_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:11272
0xf034fa cp_parser_compound_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:11226
0xf96a6b cp_parser_function_body
        /home/vegard/git/gcc/gcc/cp/parser.c:21776
0xf96a6b cp_parser_ctor_initializer_opt_and_function_body
        /home/vegard/git/gcc/gcc/cp/parser.c:21811
0xf9fc75 cp_parser_function_definition_after_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:26816
0xfa1f3c cp_parser_late_parsing_for_member
        /home/vegard/git/gcc/gcc/cp/parser.c:27697
0xf1c0e5 cp_parser_class_specifier_1
        /home/vegard/git/gcc/gcc/cp/parser.c:22740
0xf2763b cp_parser_class_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:22766
0xf2763b cp_parser_type_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:16772
0xf8c7ba cp_parser_decl_specifier_seq
        /home/vegard/git/gcc/gcc/cp/parser.c:13627
0xfa6ddf cp_parser_single_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:27185
0xfc9658 cp_parser_template_declaration_after_parameters
        /home/vegard/git/gcc/gcc/cp/parser.c:26874
0xfc7c5b cp_parser_explicit_template_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:27112


More information about the Gcc-bugs mailing list