------- Comment #1 from rguenth at gcc dot gnu dot org 2006-03-06 10:39 ------- gcc_assert (!TYPE_HAS_COMPLEX_INIT_REF (type) || !TYPE_HAS_COMPLEX_ASSIGN_REF (type) /* But storing a CONSTRUCTOR isn't a copy. */ || TREE_CODE (exp) == CONSTRUCTOR /* And, the gimplifier will sometimes make a copy of an aggregate. In particular, for a case like:
struct S { S(); }; struct X { int a; S s; }; X x = { 0 }; the gimplifier will create a temporary with static storage duration, perform static initialization of the temporary, and then copy the result. Since the "s" subobject is never constructed, this is a valid transformation. */ || CP_AGGREGATE_TYPE_P (type)); (gdb) call debug_tree(0x40247958) <record_type 0x40247958 A addressable volatile needs-constructing type_1 type_5 BLK size <integer_cst 0x4018d1e0 type <integer_type 0x4019e05c bit_size_type> constant invariant 8> unit size <integer_cst 0x4018d1f8 type <integer_type 0x4019e000 unsigned int> constant invariant 1> align 8 symtab 0 alias set -1 fields <type_decl 0x402149c0 A type <record_type 0x40247450 A addressable needs-constructing type_1 type_5 BLK size <integer_cst 0x4018d1e0 8> unit size <integer_cst 0x4018d1f8 1> align 8 symtab 0 alias set -1 fields <type_decl 0x402149c0 A> needs-constructor X(constX&) this=(X&) n_parents=0 use_template=0 interface-unknown pointer_to_this <pointer_type 0x4024761c> reference_to_this <reference_type 0x402476d4> chain <type_decl 0x40214958 A>> nonlocal decl_4 VOID file /tmp/t.C line 2 align 1 context <record_type 0x40247450 A> > needs-constructor X(constX&) this=(X&) n_parents=0 use_template=0 interface-unknown pointer_to_this <pointer_type 0x40247a10>> (gdb) call debug_tree(exp) <indirect_ref 0x4020eb00 ... arg 0 <parm_decl 0x40196c30 this type <pointer_type 0x40247a6c type <record_type 0x40247958 A> readonly unsigned SI size <integer_cst 0x4018d3d8 constant invariant 32> unit size <integer_cst 0x4018d168 constant invariant 4> align 32 symtab 0 alias set -1> readonly used unsigned SI file /tmp/t.C line 10 size <integer_cst 0x4018d3d8 32> unit size <integer_cst 0x4018d168 4> align 32 context <function_decl 0x40245d80 baz> initial <pointer_type 0x40247a6c> (mem/f/c/i:SI (reg/f:SI 53 virtual-incoming-args) [0 this+0 S4 A32]) arg-type <pointer_type 0x40247a6c> incoming-rtl (mem/f/c/i:SI (reg/f:SI 53 virtual-incoming-args) [0 this+0 S4 A32])>> The last conditional should probably apply here: CP_AGGREGATE_TYPE_P (type) but it doesn't due to CLASSTYPE_NON_AGGREGATE (TYPE) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26577