Bugzilla – Bug 90
[C++] Initializing array with constructable objects fail
Last modified: 2003-11-04 23:37:47
You need to log in before you can comment on or make changes to this bug.
The following testcase crashes the C++ front-end: ---- struct Foo { Foo(int); }; void foo() { struct { Foo name; } Int[] = { 1 }; } ---- $ llvmg++ test.cc -c test.cc: In function `void foo()': test.cc:8: internal compiler error: tree check: expected constructor, have target_expr in llvm_expand_constructor_elements, at llvm-expand.c:3318 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://llvm.cs.uiuc.edu> for instructions. --- Testcase is here: test/Regression/C++Frontend/2003-11-04-ArrayConstructors.cpp
Fixed like this: $ diff -u llvm-expand.c~ llvm-expand.c --- llvm-expand.c~ 2003-11-04 12:31:40.000000000 -0600 +++ llvm-expand.c 2003-11-04 23:30:18.000000000 -0600 @@ -3145,7 +3145,10 @@ if (llvm_type_is_composite(ExpTy)) { if (TREE_CODE(value) == COMPOUND_LITERAL_EXPR) { llvm_expand_expr(Fn, value, Offset); + } else if (TREE_CODE(value) == TARGET_EXPR) { + llvm_expand_expr(Fn, value, Offset); } else { + assert(TREE_CODE(value) == CONSTRUCTOR); llvm_expand_constructor(Fn, value, Offset, isVolatile); }