[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 09:38:17 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/docs/ReleaseNotes.rst:58
   Clang will only search for std::coroutine_traits for coroutines then.
+- Clang doesn't accept flexible array members in unions in C++ anymore.
 
----------------



================
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>;
----------------
Should this be updated to remove the union case?


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:6252
   "flexible array member %0 in otherwise empty "
   "%select{struct|interface|union|class|enum}1 is a GNU extension">,
   InGroup<GNUEmptyStruct>;
----------------
Same question here


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:6255
-def ext_flexible_array_union_gnu : Extension<
-  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
 
----------------
This was the last use of this diagnostic group, so we can remove it from `DiagnosticGroups.td` as well.


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