Have Sema::CheckConstantInitList skip semantic analysis when the element type is a record (until we implement the FIXME). This removes a bogus error for the following code...

snarofflocal% cat bug.m

#import <Foundation/NSGeometry.h>

#define NUMHELICOPTERRECTS 5

static NSRect helicopterRects[NUMHELICOPTERRECTS] = {
    {{27, 0}, {18, 11}},	// Bottom
    {{0, 8}, {4, 11}},		// Tail
    {{0, 16}, {50, 1}},
    {{22, 5}, {18, 12}},	// Body
    {{0, 10}, {42, 3}}
};

llvm-svn: 44684
This commit is contained in:
Steve Naroff 2007-12-07 21:12:53 +00:00
parent 888f33cc44
commit 2c20c38ced

View File

@ -453,6 +453,9 @@ void Sema::CheckConstantInitList(QualType DeclType, InitListExpr *IList,
int maxElementsAtThisLevel = 0;
int nInitsAtLevel = 0;
if (ElementType->isRecordType()) // FIXME: until we support structures...
return;
if (const ConstantArrayType *CAT = DeclType->getAsConstantArrayType()) {
// We have a constant array type, compute maxElements *at this level*.
maxElementsAtThisLevel = CAT->getMaximumElements();