Closed
Description
Bugzilla Link | 23812 |
Version | trunk |
OS | All |
Reporter | LLVM Bugzilla Contributor |
CC | @DougGregor,@Dushistov,@itollefsen,@zygoloid,@timsong-cpp,@jwakely |
Extended Description
Test case:
#include <initializer_list>
#include <iostream>
struct Q {
Q() { std::cout << "default\n"; }
Q(Q const&) { std::cout << "copy\n"; }
Q(Q&&) { std::cout << "move\n"; }
Q(std::initializer_list<Q>) { std::cout << "initializer list\n"; }
};
int main() {
Q x = Q { Q() };
}
Q { Q() }
should invoke the initializer_list
constructor, but recent Clang (trunk as of today, r239482) treats it as a move instead. For comparison, clang 3.6 and older, gcc 4.9, 5.1, and MSVC2015 all select the initializer_list
constructor.
This is really bad for us, as it silently changes the meaning of code in a subtle way (manifests as making our JSON library elide single-element array literals). :(