RESOLVED FIXED 170875
Cannot compile JavaScriptCore/runtime/VMTraps.cpp on FreeBSD because std::pair has a non-trivial copy constructor
https://bugs.webkit.org/show_bug.cgi?id=170875
Summary Cannot compile JavaScriptCore/runtime/VMTraps.cpp on FreeBSD because std::pai...
Ting-Wei Lan
Reported 2017-04-15 08:26:25 PDT
In JavaScriptCore/runtime/VMTraps.cpp, function findActiveVMAndStackBounds returns a WTF::Expected<std::pair<JSC::VM*, WTF::StackBounds>, JSC::VMTraps::Error>. The parent class of this type is WTF::ExpectedDetail::ConstexprBase<std::pair<JSC::VM*, WTF::StackBounds>, JSC::VMTraps::Error>. WTF::ExpectedDetail::ConstexprBase doesn't have a user-defined copy constructor, and its implicitly-defined copy constructor is deleted because the default std::pair implementation on FreeBSD has a non-trivial copy constructor. /usr/include/c++/v1/__config says _LIBCPP_TRIVIAL_PAIR_COPY_CTOR is disabled in order to keep ABI compatibility: https://svnweb.freebsd.org/changeset/base/261801. Error messages showed by the compiler (clang 3.8): /path/to/WebKit/Source/JavaScriptCore/runtime/VMTraps.cpp:96:9: error: returning object of type 'Expected<std::pair<VM *, StackBounds>, VMTraps::Error>' invokes deleted constructor return makeUnexpected(VMTraps::Error::LockUnavailable); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../Source/WTF/wtf/Expected.h:262:5: note: explicitly defaulted function was implicitly deleted here Expected(const Expected&) = default; ^ ../../Source/WTF/wtf/Expected.h:248:18: note: copy constructor of 'Expected<std::__1::pair<JSC::VM *, WTF::StackBounds>, JSC::VMTraps::Error>' is implicitly deleted because base class 'ExpectedDetail::BaseSelect<pair<VM *, StackBounds>, Error>' (aka 'WTF::ExpectedDetail::ConstexprBase<std::__1::pair<JSC::VM *, WTF::StackBounds>, JSC::VMTraps::Error>') has a deleted copy constructor class Expected : private ExpectedDetail::BaseSelect<T, E> { ^ ../../Source/WTF/wtf/Expected.h:145:44: note: copy constructor of 'ConstexprBase<std::__1::pair<JSC::VM *, WTF::StackBounds>, JSC::VMTraps::Error>' is implicitly deleted because field 's' has a deleted copy constructor ConstexprStorage<ValueType, ErrorType> s; ^ ../../Source/WTF/wtf/Expected.h:87:15: note: copy constructor of 'ConstexprStorage<std::__1::pair<JSC::VM *, WTF::StackBounds>, JSC::VMTraps::Error>' is implicitly deleted because variant field 'val' has a non-trivial copy constructor ValueType val; ^
Attachments
patch (3.88 KB, patch)
2017-04-19 09:54 PDT, JF Bastien
no flags
JF Bastien
Comment 1 2017-04-19 01:25:59 PDT
It is surprising to see the constexpr version being instantiated here.
Ting-Wei Lan
Comment 2 2017-04-19 08:27:47 PDT
(In reply to JF Bastien from comment #1) > It is surprising to see the constexpr version being instantiated here. JSC::VM*, WTF::StackBounds, JSC::VMTraps::Error are all trivially destructible, so WTF::ExpectedDetail::BaseSelect is WTF::ExpectedDetail::ConstexprBase here.
JF Bastien
Comment 3 2017-04-19 09:54:47 PDT
Created attachment 307486 [details] patch (In reply to Ting-Wei Lan from comment #2) > (In reply to JF Bastien from comment #1) > > It is surprising to see the constexpr version being instantiated here. > > JSC::VM*, WTF::StackBounds, JSC::VMTraps::Error are all trivially > destructible, so WTF::ExpectedDetail::BaseSelect is > WTF::ExpectedDetail::ConstexprBase here. Derp, right you are! Here's a patch that works around the issue.
Mark Lam
Comment 4 2017-04-19 09:56:53 PDT
Comment on attachment 307486 [details] patch r=me if EWS bots build and are happy.
JF Bastien
Comment 5 2017-04-19 10:40:40 PDT
Comment on attachment 307486 [details] patch Tests are broken for unrelated reason. Fetch or somesuch. cq+
WebKit Commit Bot
Comment 6 2017-04-19 11:25:46 PDT
Comment on attachment 307486 [details] patch Clearing flags on attachment: 307486 Committed r215522: <http://trac.webkit.org/changeset/215522>
WebKit Commit Bot
Comment 7 2017-04-19 11:25:48 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.