[PATCH] D126864: [clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays

Martin Sebor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 12 08:34:26 PDT 2022


msebor added inline comments.


================
Comment at: clang/docs/ClangCommandLineReference.rst:2648
+
+Control which arrays are considered as flexible arrays members. <arg>
+can be 1 (array of size 0, 1 and undefined are considered) or 2 (array of size 0
----------------
aaron.ballman wrote:
> This phrasing is problematic because it uses the term "flexible array members" which is a term of art in the standard when it's really talking about something else. We don't want `int trailing[1];` to be considered a flexible array member in terms of the language rules.
A pedantic reading of the text would suggest that the type of `s.trailing` is incomplete at level 1 and `sizeof s.trailing` is invalid (requiring an error).  Another minor issue is that the text refers to a size of the array when it actually means the number of elements.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126864



More information about the cfe-commits mailing list