https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84596
Bug ID: 84596 Summary: internal compiler error: unexpected expression '(bool)c' of kind implicit_conv_expr (cxx_eval_constant_expression) Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vegard.nossum at gmail dot com Target Milestone: --- Input: template<int x> void b(int c) { static_assert(c); } Output: $ xgcc -x c++ -std=c++14 -O3 -c - <stdin>: In function 'void b(int)': <stdin>:3:16: error: non-constant condition for static assertion <stdin>:3:16: internal compiler error: unexpected expression '(bool)c' of kind implicit_conv_expr 0xa3811b cxx_eval_constant_expression /home/vegard/git/gcc/gcc/cp/constexpr.c:4730 0xa4a9da cxx_eval_outermost_constant_expr /home/vegard/git/gcc/gcc/cp/constexpr.c:4790 0x12a074d finish_static_assert(tree_node*, tree_node*, unsigned int, bool) /home/vegard/git/gcc/gcc/cp/semantics.c:8674 0xec9191 cp_parser_static_assert /home/vegard/git/gcc/gcc/cp/parser.c:13893 0xfa9bd1 cp_parser_block_declaration /home/vegard/git/gcc/gcc/cp/parser.c:12823 0xfab154 cp_parser_declaration_statement /home/vegard/git/gcc/gcc/cp/parser.c:12420 0xef6e13 cp_parser_statement /home/vegard/git/gcc/gcc/cp/parser.c:10869 0xefb1eb cp_parser_statement_seq_opt /home/vegard/git/gcc/gcc/cp/parser.c:11218 0xefbc8a cp_parser_compound_statement /home/vegard/git/gcc/gcc/cp/parser.c:11172 0xf8fb9b cp_parser_function_body /home/vegard/git/gcc/gcc/cp/parser.c:21712 0xf8fb9b cp_parser_ctor_initializer_opt_and_function_body /home/vegard/git/gcc/gcc/cp/parser.c:21747 0xf98da5 cp_parser_function_definition_after_declarator /home/vegard/git/gcc/gcc/cp/parser.c:26648 0xf9f305 cp_parser_function_definition_from_specifiers_and_declarator /home/vegard/git/gcc/gcc/cp/parser.c:26565 0xf9f305 cp_parser_init_declarator /home/vegard/git/gcc/gcc/cp/parser.c:19436 0xfa0909 cp_parser_single_declaration /home/vegard/git/gcc/gcc/cp/parser.c:27111 0xfc2718 cp_parser_template_declaration_after_parameters /home/vegard/git/gcc/gcc/cp/parser.c:26706 0xfc0d1b cp_parser_explicit_template_declaration /home/vegard/git/gcc/gcc/cp/parser.c:26944 0xfc0d1b cp_parser_template_declaration_after_export /home/vegard/git/gcc/gcc/cp/parser.c:26962 0xffbd51 cp_parser_declaration /home/vegard/git/gcc/gcc/cp/parser.c:12673 0xff298b cp_parser_declaration_seq_opt /home/vegard/git/gcc/gcc/cp/parser.c:12600 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. Version: xgcc (GCC) 8.0.1 20180204 (experimental) built from git fdae6180ad24fa6303fa046114f3e4b66b8db34d Version 7.3.0 don't seem to be affected AFAICS. gcc trunk on godbolt.org (8.0.1 20180227) gives: <source>: In function 'void b(int)': <source>:3:23: error: non-constant condition for static assertion static_assert(c); ^ <source>:3:23: internal compiler error: unexpected expression '(bool)c' of kind implicit_conv_expr mmap: Invalid argument Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1 Test case was reduced using C-Reduce.