https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71205
Bug ID: 71205 Summary: c++14 wrong constructor resolution Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dushistov at mail dot ru Target Milestone: --- #include <initializer_list> #include <iostream> #define SHOW std::cout << __PRETTY_FUNCTION__ << "\n" struct Foo { Foo() { SHOW; } Foo(const Foo &) { SHOW; } Foo(Foo &&) { SHOW; } Foo(std::initializer_list<Foo>) { SHOW; } }; int main() { Foo b; Foo x = Foo { b }; } accroding to http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1467 and http://en.cppreference.com/w/cpp/language/list_initialization If T is a class type and the initializer list has a single element of the same or derived type (possibly cv-qualified), the object is initialized from that element (by copy-initialization for copy-list-initialization, or by direct-initialization for direct-list-initialization). This code should print: Foo::Foo() Foo::Foo(const Foo &) clang (3.8.0) and mvsc++ print lines above, but gcc (5.2, 6.1.1) print (g++ -std=c++14 -pedantic test.cpp): Foo::Foo() Foo::Foo(const Foo&) Foo::Foo(std::initializer_list<Foo>) which is wrong