================
@@ -18903,6 +18903,10 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind 
TUK, SourceLocation KWLoc,
     } else
       New = RecordDecl::Create(Context, Kind, SearchDC, KWLoc, Loc, Name,
                                cast_or_null<RecordDecl>(PrevDecl));
+
+    // Impossible to decl struct/union/class in enum
+    if (isa<EnumDecl>(SearchDC))
+      Invalid = true;
----------------
ChenMiaoi wrote:

Would setting `Invalid = true` here be too broad? It seems to introduce new 
issues, for example:

``` cc
enum E { 
    A = sizeof(struct { int x; }) 
};
```

It seems skip some checks.

https://github.com/llvm/llvm-project/pull/200214
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to