RESOLVED DUPLICATE of bug 132348 157452
NeverDestroyed<> constructor does not pass std::initializer_list correctly
https://bugs.webkit.org/show_bug.cgi?id=157452
Summary NeverDestroyed<> constructor does not pass std::initializer_list correctly
Jer Noble
Reported 2016-05-07 09:52:30 PDT
Created attachment 278325 [details] TestCase.cpp The following code fails to compile: #include <wtf/NeverDestroyed.h> #include <wtf/Vector.h> int main() { Vector<int> v1 = {1, 2, 3}; // OK NeverDestroyed<Vector<int>> v2 = {1, 2, 3}; // "error: no matching constructor for initialization of 'WTF::Vector<int, 0, WTF::CrashOnOverflow, 16>" return 0; } This is likely because the "std::forward<Args>(args)..." in the NeverDestroyed constructor unrolls the initializer_list into a sequence of parameters, rather than passing it unadulterated.
Attachments
TestCase.cpp (156 bytes, application/octet-stream)
2016-05-07 09:52 PDT, Jer Noble
no flags
Darin Adler
Comment 1 2017-07-21 20:23:35 PDT
*** This bug has been marked as a duplicate of bug 132348 ***
Note You need to log in before you can comment on or make changes to this bug.