https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115861
Bug ID: 115861 Summary: ICE: tree check: expected template_decl, have overload in cplus_decl_attributes, at cp/decl2.cc:1896 with deprecated attribute Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- ******************************************************************************* OS and Platform: $ uname -a: Linux 65dac7c84719 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* gcc version: Using built-in specs. COLLECT_GCC=/home/software/gcc-trunk-3aa004f/bin/gcc COLLECT_LTO_WRAPPER=/home/software/gcc-trunk-3aa004f/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --disable-multilib --disable-bootstrap --enable-languages=c,c++ --prefix=/home/software/gcc-trunk-3aa004f --enable-coverage Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240630 (experimental) (GCC) ******************************************************************************* Program: $ cat mutant.C struct { template < a > void b(; __attribute__((deprecated)) friend b<>( ******************************************************************************* Command Lines: $ gcc mutant.C mutant.C:1:30: error: 'a' has not been declared 1 | struct { template < a > void b(; __attribute__((deprecated)) friend b<>( | ^ mutant.C:1:41: error: expected identifier before ';' token 1 | struct { template < a > void b(; __attribute__((deprecated)) friend b<>( | ^ mutant.C:1:41: error: expected ')' before ';' token 1 | struct { template < a > void b(; __attribute__((deprecated)) friend b<>( | ~^ | ) mutant.C:1:97: error: expected identifier at end of input 1 | struct { template < a > void b(; __attribute__((deprecated)) friend b<>( | ^ mutant.C:1:97: error: expected ',' or '...' at end of input mutant.C:1:97: error: expected ')' at end of input 1 | struct { template < a > void b(; __attribute__((deprecated)) friend b<>( | ~^ | ) mutant.C:1:93: error: ISO C++ forbids declaration of 'b' with no type [-fpermissive] 1 | struct { template < a > void b(; __attribute__((deprecated)) friend b<>( | ^~~ mutant.C:1:97: internal compiler error: tree check: expected template_decl, have overload in cplus_decl_attributes, at cp/decl2.cc:1896 1 | struct { template < a > void b(; __attribute__((deprecated)) friend b<>( | ^ 0x576c1eb diagnostic_context::report_diagnostic(diagnostic_info*) ???:0 0x576cabd diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x578c98b internal_error(char const*, ...) ???:0 0x2d6b950 tree_check_failed(tree_node const*, char const*, int, char const*, ...) ???:0 0xdca713 tree_check(tree_node*, char const*, int, char const*, tree_code) ???:0 0x10731f6 cplus_decl_attributes(tree_node**, tree_node*, int) ???:0 0x102cddb grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*, decl_context, int, tree_node**) ???:0 0x106d240 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*, bool, tree_node*, tree_node*) ???:0 0x1378350 c_parse_file() ???:0 0x171c898 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Also ICE on trunk. Compiler Explorer: https://godbolt.org/z/cjYGE3jcP