mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/49996 (Internal error in verify_gimple_stmt: initializing struct in new-initializer)
PR c++/49996 * tree.c (stabilize_init): Stabilize scalar elements of a CONSTRUCTOR, too. From-SVN: r180441
This commit is contained in:
parent
04cc7d7c13
commit
0c59fd2fd2
|
@ -1,3 +1,9 @@
|
||||||
|
2011-10-25 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/49996
|
||||||
|
* tree.c (stabilize_init): Stabilize scalar elements of a
|
||||||
|
CONSTRUCTOR, too.
|
||||||
|
|
||||||
2011-10-25 Paolo Carlini <paolo.carlini@oracle.com>
|
2011-10-25 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
PR c++/50858
|
PR c++/50858
|
||||||
|
|
|
@ -3345,11 +3345,20 @@ stabilize_init (tree init, tree *initp)
|
||||||
/* Aggregate initialization: stabilize each of the field
|
/* Aggregate initialization: stabilize each of the field
|
||||||
initializers. */
|
initializers. */
|
||||||
unsigned i;
|
unsigned i;
|
||||||
tree value;
|
constructor_elt *ce;
|
||||||
bool good = true;
|
bool good = true;
|
||||||
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (t), i, value)
|
VEC(constructor_elt,gc) *v = CONSTRUCTOR_ELTS (t);
|
||||||
if (!stabilize_init (value, initp))
|
for (i = 0; VEC_iterate (constructor_elt, v, i, ce); ++i)
|
||||||
good = false;
|
{
|
||||||
|
tree type = TREE_TYPE (ce->value);
|
||||||
|
tree subinit;
|
||||||
|
if (TREE_CODE (type) == REFERENCE_TYPE
|
||||||
|
|| SCALAR_TYPE_P (type))
|
||||||
|
ce->value = stabilize_expr (ce->value, &subinit);
|
||||||
|
else if (!stabilize_init (ce->value, &subinit))
|
||||||
|
good = false;
|
||||||
|
*initp = add_stmt_to_compound (*initp, subinit);
|
||||||
|
}
|
||||||
return good;
|
return good;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2011-10-25 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/49996
|
||||||
|
* g++.dg/cpp0x/initlist59.C: New.
|
||||||
|
|
||||||
2011-10-25 Paolo Carlini <paolo.carlini@oracle.com>
|
2011-10-25 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
PR c++/50858
|
PR c++/50858
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
// PR c++/49996
|
||||||
|
// { dg-options -std=c++0x }
|
||||||
|
|
||||||
|
struct A
|
||||||
|
{
|
||||||
|
~A()
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct B
|
||||||
|
{
|
||||||
|
const A& ref;
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
B* p = new B{A()};
|
||||||
|
}
|
Loading…
Reference in New Issue