[PATCH] Sema: Treat zero sized arrays as flexible array members

David Majnemer david.majnemer at gmail.com
Mon Sep 29 13:33:38 PDT 2014


I haven't tested it much beyond self hosting and targeted test cases.

================
Comment at: test/SemaCXX/zero-length-arrays.cpp:13
@@ -13,5 +12,3 @@
   int foo_count;
-  Foo foos[0];
-  Foo foos2[0][2];
-  Foo foos3[2][0];
+  Foo foos[0]; // expected-error-re {{flexible array member {{.*}} with non-trivial destruction}}
 
----------------
rsmith wrote:
> Can we find out what rdar://problem/10228639 was?
> interaction between having a trailing zero-sized array in a struct (C++ extension) and whether that implies having a default constructor.
> the usual sort of thing. language extension interaction w/ actual language standard. things get odd.

http://reviews.llvm.org/D5478






More information about the cfe-commits mailing list