[cfe-dev] Default argument constructor with brace initialized array miscompilation

Adam Nowacki via cfe-dev cfe-dev at lists.llvm.org
Sat Apr 29 15:32:22 PDT 2017


https://godbolt.org/g/sm5tMo

For code below there are missing destructor calls - make_a() is called 5 times but ~A() only once.

struct A {
    ~A();
};
A make_a();
struct B {
    B(A a = make_a()) {};
};

int main() {
    B b[5] = {};
}



More information about the cfe-dev mailing list