WTF::Expected should use std::addressof instead of operator&
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2019 06:04:22 +0000 (06:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2019 06:04:22 +0000 (06:04 +0000)
commit4111074a7a5ad763ab18e172fb098203149250d8
tree7a99c9dad5a42c51094642e214583a2db7adffc2
parent9af6bb22925ecb86c0cc1cc73971551e4f5626a4
WTF::Expected should use std::addressof instead of operator&
https://bugs.webkit.org/show_bug.cgi?id=195604

Patch by Alex Christensen <achristensen@webkit.org> on 2019-03-11
Reviewed by Myles Maxfield.

Source/WTF:

The latter was causing problems with types that do tricky things with constructors and operator&,
specifically UniqueRef but I made a reduced test case.  When it used operator&, it would get the contained
type and call the constructor that takes a contained type instead of the move constructor.

* wtf/Expected.h:
(std::experimental::fundamentals_v3::__expected_detail::base::base):
(std::experimental::fundamentals_v3::expected::swap):

Tools:

* TestWebKitAPI/Tests/WTF/Expected.cpp:
(TestWebKitAPI::Unique::Unique):
(TestWebKitAPI::Unique::operator&):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242778 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/Expected.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/Expected.cpp