Initializer assertion failure

I get an assert with -emit-llvm compiling

typedef struct
{
  unsigned short a, b, c;
} z;

static const z zs =
{
  { 0x00aa, 0x00aa, 1 },
};

assertion "ILE->getType()->isArrayType() ||
ILE->getType()->isStructureType()" failed: file "CodeGenModule.cpp",
line 284, function "llvm::Constant* GenerateAggregateInit(const
clang::InitListExpr*, clang::CodeGen::CodeGenModule&)"
Abort trap

Neil.

Yeah that's a known issue -- i believe Anders was looking at it, although i'm sure no one will mind if you do :smiley:

The problem is that the inner ILE (eg. { 0x00aa, ...} ) is initialised to void, and the correct type is never set.

I think there's even a fixme right before it sets the ILE type to void :smiley:

--Oliver

This seems to do the job for this specific case, but I know it isn't a
complete solution. In the mean time, you can use it to find other
failures.

Index: Sema/SemaDecl.cpp