@@ -5873,6 +5873,11 @@ consider_binding_level (tree name, best_match <tree, const char *> &bm,
if (!suggestion)
continue;
+ /* Don't suggest names that are for anonymous aggregate types, as
+ they are an implementation detail generated by the compiler. */
+ if (anon_aggrname_p (suggestion))
+ continue;
+
const char *suggestion_str = IDENTIFIER_POINTER (suggestion);
/* Ignore internal names with spaces in them. */
new file mode 100644
@@ -0,0 +1,11 @@
+/* PR c++/86329: ensure we don't erroneously offer suggestions like "._0",
+ which are an implementation detail of how e.g. anonymous enums are
+ handled internally. */
+
+enum {NONEMPTY};
+
+int test()
+{
+ return __0; // { dg-error "'__0' was not declared in this scope" }
+ // { dg-bogus "suggested alternative" "" { target *-*-* } .-1 }
+}