[cfe-dev] Bug: assertion "only C++ supports non-constant static initializers!"

Douglas Gregor dgregor at apple.com
Thu Jan 29 09:58:31 PST 2009


On Jan 29, 2009, at 1:19 AM, Max Kellermann wrote:
> with clang r63301, I get the following assertion failure:
>
> clang: CGDecl.cpp:93: llvm::GlobalValue*
> clang::CodeGen::CodeGenFunction::GenerateStaticBlockVarDecl(const
> clang::VarDecl&, bool, const char*): Assertion
> `getContext().getLangOptions().CPlusPlus && "only C++ supports
> non-constant static initializers!"' failed.
>
> A test source and the full error message is attached.

Thanks!

> The error occurs only if the first element of "struct foo" is a
> pointer and only the second one gets explicitly initialized.

This is related to my changes to semantic analysis for designated  
initializers. I've fixed the assertion here:

	http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090126/011516.html

However, this code now gives an

   error: cannot codegen this constant expression yet

since we're missing codegen for this case.

	- Doug



More information about the cfe-dev mailing list