[Bug c++/93869] [10 Regression] ICE in contains_struct_check with -Wmismatched-tags upon redundant typename
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 21 13:26:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93869
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This patch https://gcc.gnu.org/ml/gcc-patches/2020-02/msg01183.html does not
fix it. I think the fix is to check class_key earlier in the function:
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -30987,6 +30987,13 @@ cp_parser_check_class_key (cp_parser *parser,
location_t key_loc,
if (!warn_mismatched_tags && !warn_redundant_tags)
return;
+ /* Only consider the true class-keys below and ignore typename_type,
+ etc. that are not C++ class-keys. */
+ if (class_key != class_type
+ && class_key != record_type
+ && class_key != union_type)
+ return;
+
tree type_decl = TYPE_MAIN_DECL (type);
tree name = DECL_NAME (type_decl);
/* Look up the NAME to see if it unambiguously refers to the TYPE
@@ -30995,13 +31002,6 @@ cp_parser_check_class_key (cp_parser *parser,
location_t key_loc,
tree decl = cp_parser_lookup_name_simple (parser, name, input_location);
pop_deferring_access_checks ();
- /* Only consider the true class-keys below and ignore typename_type,
- etc. that are not C++ class-keys. */
- if (class_key != class_type
- && class_key != record_type
- && class_key != union_type)
- return;
-
/* The class-key is redundant for uses of the CLASS_TYPE that are
neither definitions of it nor declarations, and for which name
lookup returns just the type itself. */
Martin, do you want me to post it? (I can wait until your patch above is
committed if you don't want any conflicts.)
More information about the Gcc-bugs
mailing list