Imagine that we have:
struct S {
struct S {
S() { printf("%s\n", __PRETTY_FUNCTION__); }
S(const S&) { printf("%s\n", __PRETTY_FUNCTION__); }
S(S&&) { printf("%s\n", __PRETTY_FUNCTION__); }
~S() { printf("%s\n", __PRETTY_FUNCTION__); }
S(std::initializer_list<S>) { printf("%s\n", __PRETTY_FUNCTION__); }
};
Which constructors should be called when S s2{S{}};?
Is it ok that gcc and clang have different behavior?
Example: https://godbolt.org/z/qQxyp5
gcc (trunk) output:
S::S()
S::S(std::initializer_list<S>)
S::~S()
S::~S()
clang (trunk) output:
S::S()
S::~S()