I recently came upon this code:
struct Foo{};
int main()
{
Foo a;
// clang++ deduces std::initializer_list
// g++5.1 deduces Foo
auto b{a};
a = b;
}
It compiles fine with g++5.1, but fails in clang++. The reason is that clang++ deduces the type of b as std::initializer_list<Foo>, whereas g++5.1 deduces as Foo. AFAIK, the type should indeed be (counter-intuitive indeed) std::initializer_list here. Is this correct, and if yes, is this a known "bug" of g++5?
Aucun commentaire:
Enregistrer un commentaire