Started with r8 before 20180525 : $ cat z1.cc struct { struct { operator int (); int a; }; operator int; }; $ g++-11-20201122 -c z1.cc z1.cc:6:12: internal compiler error: tree check: expected overload, have function_decl in get_class_binding_direct, at cp/name-lookup.c:1332 6 | operator int | ^~~ 0x6520ba tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/tree.c:9810 0x7fad5a tree_check(tree_node*, char const*, int, char const*, tree_code) ../../gcc/tree.h:3317 0x7fad5a get_class_binding_direct(tree_node*, tree_node*, bool) ../../gcc/cp/name-lookup.c:1332 0x8ea66b lookup_field_r ../../gcc/cp/search.c:978 0x8e904e dfs_walk_all(tree_node*, tree_node* (*)(tree_node*, void*), tree_node* (*)(tree_node*, void*), void*) ../../gcc/cp/search.c:1408 0x8e91fc lookup_member(tree_node*, tree_node*, int, bool, int, access_failure_info*) ../../gcc/cp/search.c:1121 0x8e95a0 lookup_fnfields(tree_node*, tree_node*, int, int) ../../gcc/cp/search.c:1327 0x80aada lookup_name_1 ../../gcc/cp/name-lookup.c:6587 0x80aada lookup_name(tree_node*, LOOK_where, LOOK_want) ../../gcc/cp/name-lookup.c:6665 0x811255 lookup_name(tree_node*, LOOK_want) ../../gcc/cp/name-lookup.h:294 0x811255 cp_parser_lookup_name ../../gcc/cp/parser.c:28864 0x818615 cp_parser_diagnose_invalid_type_name ../../gcc/cp/parser.c:3365 0x84a063 cp_parser_parse_and_diagnose_invalid_type_name ../../gcc/cp/parser.c:3619 0x860367 cp_parser_member_declaration ../../gcc/cp/parser.c:25456 0x82f722 cp_parser_member_specification_opt ../../gcc/cp/parser.c:25306 0x82f722 cp_parser_class_specifier_1 ../../gcc/cp/parser.c:24395 0x832159 cp_parser_class_specifier ../../gcc/cp/parser.c:24706 0x832159 cp_parser_type_specifier ../../gcc/cp/parser.c:17962 0x832d86 cp_parser_decl_specifier_seq ../../gcc/cp/parser.c:14584 0x8339f1 cp_parser_simple_declaration ../../gcc/cp/parser.c:13841
Started to ICE with r8-7029-g35129fd3a745403b.
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:936d500dfc17f58f2507ecd0f7f26e4f197052ee commit r11-8120-g936d500dfc17f58f2507ecd0f7f26e4f197052ee Author: Jason Merrill <jason@redhat.com> Date: Sat Apr 10 14:00:15 2021 -0400 c++: ICE with anonymous union [PR97974] Here lookup got confused by finding a conversion operator from lookup_anon_field. Let's avoid this by pruning functions from CLASSTYPE_MEMBER_VEC as well as TYPE_FIELDS. gcc/cp/ChangeLog: PR c++/97974 * decl.c (fixup_anonymous_aggr): Prune all functions from CLASSTYPE_MEMBER_VEC. gcc/testsuite/ChangeLog: PR c++/97974 * g++.dg/lookup/pr84962.C: Adjust diagnostic. * g++.dg/other/anon-union5.C: New test.
Fixed for 11 so far.
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:58a92b789a77cdade1f41800efebf6e0686f9982 commit r12-298-g58a92b789a77cdade1f41800efebf6e0686f9982 Author: Jason Merrill <jason@redhat.com> Date: Sat Apr 10 14:00:15 2021 -0400 c++: ICE with anonymous union [PR97974] While working on the GCC 11 patch, it occurred to me that we could move the errors about invalid members from finish_struct_anon_r to here, so we properly get a diagnostic in g++.law/union4.C. gcc/cp/ChangeLog: PR c++/97974 * class.c (finish_struct_anon_r): Drop complain parm. Remove non-field diagnostic. (finish_struct_anon): Adjust. * decl.c (fixup_anonymous_aggr): Move non-field diagnostic here. gcc/testsuite/ChangeLog: PR c++/97974 * g++.old-deja/g++.law/union4.C: Add expected diagnostic.
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
GCC 9 branch is being closed
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
Fixed in GCC 11.