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
porting?

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

-- 
John Thompson
[email protected]
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to