https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57510

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The example from PR 57930 isn't fixed either:

extern "C" int printf(const char *,...);
struct B {
        B(int,int) { printf("CB %p\n",this); }
        B(const B&) { printf("const CB %pn\n",this); }
        B(B&&) { printf("const CB %pn\n",this); }
        ~B() { printf("B %p\n",this);  }
};
struct C {
        int c;
        int c2;
};
struct A {
         struct B b;
         struct C c;
};
A test() {
        //const A a1 = { { 1, 2 }, { 3, (throw 9, 4) } } ; // destructor for B
called
        //const A &a2 = { { 1, 2 }, { 3, (throw 9, 4) } } ; // destructor for B
not called
        return { { 1, 2 }, { 3, (throw 9, 4) } } ; // destructor for B not
called
};
int main() {
        try {
                test();
        } catch (...) {
        }
}

This prints:

CB 0x7ffd6eac7620


But should be:

CB 0x7ffd6eac7620
B 0x7ffd6eac7620

Reply via email to