[PATCH] D147626: [clang] Reject flexible array member in a union in C++

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 28 10:52:55 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:6241-6244
 def ext_flexible_array_empty_aggregate_ms : Extension<
   "flexible array member %0 in otherwise empty "
   "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
   InGroup<MicrosoftFlexibleArray>;
----------------
Fznamznon wrote:
> aaron.ballman wrote:
> > Should this be updated to remove the union case?
> Sounds reasonable, but what is unfortunate is that this diagnostic exactly matches TagTypeKind enum, so now it can be emitted with `Diag(...) << ... << SomeTagDecl->getTagKind().` Once I remove `union` from there, this neat thing fails.
Oh, that might be worth leaving alone then, but put a comment next to the diagnostic definition to explain the relationship to `TagTypeKind`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147626/new/

https://reviews.llvm.org/D147626



More information about the cfe-commits mailing list