First Last Prev Next    No search results available
Details
: [C++] Initializing array with constructable objects fail
Bug#: 90
: tools
: llvm-g++
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.0
: P2
: normal
: 1.1

:
: compile-fail
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <sabre@nondot.org>
Assigned To: Chris Lattner <sabre@nondot.org>

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2003-11-04 23:22
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
------- Comment #1 From Chris Lattner 2003-11-04 23:37:47 -------
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);
         }
         

First Last Prev Next    No search results available