Commit d20db242 by Jason Merrill

re PR c++/12253 ([tree-ssa] ICE on conversion to std::string inside array initialization)

        PR c++/12253
        * init.c (build_vec_init): Initialization of an element from
        an initializer list is also a full-expression.

From-SVN: r74798
parent a3bf324c
// PR c++/12253
// Bug: We were failing to destroy the temporary A passed to the
// constructor for b[0] before going on to construct b[1].
// { dg-do run }
extern "C" int printf (const char *, ...);
int c;
int r;
struct A
{
A() { printf ("A()\n"); if (c++) r = 1; }
A(const A&) { printf ("A(const A&)\n"); ++c; }
~A() { printf ("~A()\n"); --c; }
};
struct B
{
B(int, const A& = A()) { printf ("B()\n"); }
};
int main()
{
B b[] = { 0, 0 };
return r;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment