why `S x({})` invoke default constructor in GCC 7/C++1z mode only?

Viewed 939

In the following snippet, GCC 7 with C++1z mode invokes the default constructor, but GCC/C++14 and Clang/C++14,C++1z invoke the initializer-list constructor.

Is this behavior affected by any C++1z Specifiation change (possibly Guaranteed copy elision?), or GCC bug?

#include <cstdio>
#include <initializer_list>

struct S {
  S() { std::printf("DEF "); }      // (1)
  S(std::initializer_list<int> il)  // (2)
    { std::printf("L=%zu ", il.size()); }
};

int main() {
  S x({});
}

Output:

1 Answers
Related