2007-03-30 Diego Novillo Mark Mitchell PR 29585 * class.c (dfs_accumulate_vtbl_inits): Use build_address to build the vtbl entry. testsuite/ChangeLog PR 29585 * g++.dg/tree-ssa/pr29585.C: New test. Index: testsuite/g++.dg/tree-ssa/pr29585.C =================================================================== --- testsuite/g++.dg/tree-ssa/pr29585.C (revision 0) +++ testsuite/g++.dg/tree-ssa/pr29585.C (revision 0) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +class ios_base{}; +struct basic_ostream : virtual ios_base{}; +namespace +{ + struct Nullostream : basic_ostream{}; +} +class In +{ + In (); + Nullostream nullout; +}; +In::In (){} Index: cp/class.c =================================================================== --- cp/class.c (revision 123332) +++ cp/class.c (working copy) @@ -7101,7 +7101,7 @@ dfs_accumulate_vtbl_inits (tree binfo, /* Figure out the position to which the VPTR should point. */ vtbl = TREE_PURPOSE (l); - vtbl = build1 (ADDR_EXPR, vtbl_ptr_type_node, vtbl); + vtbl = build_address (vtbl); index = size_binop (PLUS_EXPR, size_int (non_fn_entries), size_int (list_length (TREE_VALUE (l))));