https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93324
Bug ID: 93324 Summary: [10 Regression] ICE with -Wall on constexpr if Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de Target Milestone: --- The following code works on gcc 9 and below, but ICEs on gcc10 with -Wall. ``` struct { template <int> static constexpr bool a() { return 0; } } e; template <typename> void d() { auto c(e); using b = decltype(c); if constexpr (b::a<2>()); } ``` See godbolt: https://godbolt.org/z/3wEnL7 ``` > g++-git -std=c++17 -Wall -c ice.cpp ice.cpp: In function ‘void d()’: ice.cpp:12:26: internal compiler error: Segmentation fault 12 | if constexpr (b::a<2>()); | ^ 0xc7230f crash_signal /home/marehr/Packages/gcc-git/src/gcc/gcc/toplev.c:328 0x783eca fndecl_built_in_p(tree_node const*, built_in_class) /home/marehr/Packages/gcc-git/src/gcc/gcc/tree.h:6208 0x783eca fndecl_built_in_p(tree_node const*, unsigned int, built_in_class) /home/marehr/Packages/gcc-git/src/gcc/gcc/tree.h:6217 0x783eca is_std_constant_evaluated_p /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/semantics.c:737 0x783eca finish_if_stmt_cond(tree_node*, tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/semantics.c:771 0x71bfcb cp_parser_selection_statement /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:11898 0x71bfcb cp_parser_statement /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:11261 0x71c8f8 cp_parser_statement_seq_opt /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:11745 0x71c9b0 cp_parser_compound_statement /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:11699 0x7325b0 cp_parser_function_body /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:22907 0x7325b0 cp_parser_ctor_initializer_opt_and_function_body /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:22958 0x735cad cp_parser_function_definition_after_declarator /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:28745 0x736ca7 cp_parser_function_definition_from_specifiers_and_declarator /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:28661 0x736ca7 cp_parser_init_declarator /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:20536 0x73b7b4 cp_parser_single_declaration /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:29236 0x73b93d cp_parser_template_declaration_after_parameters /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:28808 0x73beea cp_parser_explicit_template_declaration /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:29074 0x73f0f9 cp_parser_declaration /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:13277 0x73f6d8 cp_parser_translation_unit /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:4723 0x73f6d8 c_parse_file() /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:43569 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://bugs.archlinux.org/> for instructions. ``` This code compiles when removing the -Wall flag. ``` > g++-git -v Using built-in specs. COLLECT_GCC=g++-git COLLECT_LTO_WRAPPER=/opt/gcc/gcc-git/bin/../lib/gcc/x86_64-pc-linux-gnu/10.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/marehr/Packages/gcc-git/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++ --enable-shared --enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto --disable-boostrap Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.0.1 20200116 (experimental) (GCC) ```