Bug 261033 - makeUnique isn't always a substitute for std::make_unique
Summary: makeUnique isn't always a substitute for std::make_unique
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-09-01 07:40 PDT by Jean-Yves Avenard [:jya]
Modified: 2023-09-22 17:03 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Avenard [:jya] 2023-09-01 07:40:13 PDT
consider the following:

auto b = std::make_unique<int>(12345);

b is now an unique_ptr<int>, pointing to a single int* with a valid of 12345.

makeUnique<int>(12345>

gives the error:
```
/Users/jyavenard/Work/webkit/OpenSource/WebKitBuild/Debug/usr/local/include/wtf/StdLibExtras.h:595:41: error: type 'int' cannot be used prior to '::' because it has no members
    static_assert(std::is_same<typename T::webkitFastMalloced, int>::value, "T is FastMalloced");
                                        ^
/Users/jyavenard/Work/webkit/OpenSource/Tools/TestWebKitAPI/Tests/WebCore/MediaPromise.cpp:524:17: note: in instantiation of function template specialization 'WTF::makeUnique<int, int>' requested here
    auto test = makeUnique<int>(12345);
 ```
Comment 1 Radar WebKit Bug Importer 2023-09-01 07:40:31 PDT
<rdar://problem/114820281>