Bug 157452

Summary: NeverDestroyed<> constructor does not pass std::initializer_list correctly
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: Web Template FrameworkAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: darin
Priority: P2    
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
TestCase.cpp none

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.