[Webkit-unassigned] [Bug 157452] New: NeverDestroyed<> constructor does not pass std::initializer_list correctly

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat May 7 09:52:30 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=157452

            Bug ID: 157452
           Summary: NeverDestroyed<> constructor does not pass
                    std::initializer_list correctly
    Classification: Unclassified
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jer.noble at apple.com

Created attachment 278325
  --> https://bugs.webkit.org/attachment.cgi?id=278325&action=review
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160507/0a30fba6/attachment.html>


More information about the webkit-unassigned mailing list