http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53610
Bug #: 53610 Summary: C++11: constructors accept silly initializers Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: akim.demai...@gmail.com Created attachment 27584 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27584 test case Use braces to call a constructor, G++ 4.7 and 4.8 both accept silly arguments, provided the number of members matches the number of expected arguments. #include <iostream> class bar { public: bar(int a, int b) { std::cerr << a << ' ' << b << std::endl; } }; int main() { bar{.first = 42, .second = 51}; } $ g++-mp-4.7 --version g++-mp-4.7 (MacPorts gcc47 4.7.0_3) 4.7.0 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++-mp-4.7 -Wall -std=c++11 bar.cc $ ./a.out 42 51 $ g++-mp-4.8 --version g++-mp-4.8 (MacPorts gcc48 4.8-20120603_1) 4.8.0 20120603 (experimental) Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++-mp-4.8 -Wall -std=c++11 bar.cc $ ./a.out 42 51