The following invokes one instance of the constructor followed by the destructor of A
(vs. invoking copy or move constructors). Is this an optimization that only one instance of A
is created, or is this behavior mandated by the standard?
#include <iostream>
struct A {
A() {
std::cout << "Constructor\n";
}
~A() {
std::cout << "Destructor\n";
}
A (const A&) = delete;
};
int main() {
A a{A{A{A{A{}}}}};
}