[cfe-dev] Local nonconstant initializer list codegen assertion failure
Keith Bauer
onesadcookie at gmail.com
Sun Jan 27 17:52:52 PST 2008
I don't know what the spec has to say about code like this, certainly
GCC isn't without complaint, but generates "expected" code...
CookieJar:Desktop keith$ cat test.c
struct s { int i; };
void foo(struct s a, struct s b) {
struct s A[2] = { a, b };
}
CookieJar:Desktop keith$ gcc -Wall -Wextra -pedantic -fsyntax-only test.c
test.c: In function 'foo':
test.c:4: warning: initializer element is not computable at load time
test.c:4: warning: initializer element is not computable at load time
test.c:4: warning: unused variable 'A'
CookieJar:Desktop keith$ clang -fsyntax-only test.c
CookieJar:Desktop keith$ gcc -c test.c
CookieJar:Desktop keith$ clang -emit-llvm test.c
Assertion failed: (E && !hasAggregateLLVMType(E->getType()) &&
"Invalid scalar expression to emit"), function EmitScalarExpr, file
CGExprScalar.cpp, line 1031.
-Keith
More information about the cfe-dev
mailing list