Hi all,
Please consider for review this patch.
If a class deriving from an base class with a flexible array has no new
data members of its own, the issue of the data member offset never comes
into play. I have a large, mature codebase that tripped over this recently
added, but slightly overzealous, semantic check.
thanks,
Curtis Dunham
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp (revision 201920)
+++ lib/Sema/SemaDeclCXX.cpp (working copy)
@@ -1388,7 +1388,9 @@
// the flexible array member would index into the subsequent base.
// - If the layout determines that base comes before the derived class,
// the flexible array member would index into the derived class.
- if (CXXBaseDecl->hasFlexibleArrayMember()) {
+ // ... unless there are no data members in the derived class, in which case
+ // neither of these issues can occur.
+ if (CXXBaseDecl->hasFlexibleArrayMember() && !Class->field_empty()) {
Diag(BaseLoc, diag::err_base_class_has_flexible_array_member)
<< CXXBaseDecl->getDeclName();
return 0;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits