http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50965
Bug #: 50965
Summary: C++11 Non static member initializer are not run when
class is initialized with {}
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Using g++ (GCC) 4.7.0 20111031 (experimental)
struct A { int i = 42; };
int main() {
A a{};
std::cout << a.i << std::endl; // shows 0
std::cout << A{}.i << std::endl; // shows 0
}