[cfe-commits] [QUESTION] - array member with no size

John Thompson john.thompson.jtsoftware at gmail.com
Tue Jul 6 16:53:07 PDT 2010

Regarding bug 7032, an error is generated in the following case because of
the absence of an array size:

class test {
int m;
unsigned int mDummy[];
>clang -cc1 AttributeAligned1.cpp
AttributeAligned1.cpp:3:14: error: field has incomplete type 'unsigned int
unsigned int mDummy[];
1 error generated.
According to the standards C99_n1124 at 6.2.5.p22 and C++_n2723 at 3.9.1.p5
this is a legitimate error.  However, gcc doesn't flag it.  What do we do in
this kind of case, regarding maintaining compatibility and facilitating

The following options come to mind:

1.  Keep it an error.  It's an easy fix, adding a 0 for length.  (In my case
the field is only used for getting an aligned field offset.)
2.  Make it a warning, assume 0-size, and report this assumption and suggest
adding an explicit size.
3.  Keep it an error or warning, and have a gcc-compatibility option to
eliminate it.
4.  Silently ignore it and assume 0 size like gcc.


John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100706/14b99be7/attachment.html>

More information about the cfe-commits mailing list