Bug 226251

Summary: Clang can't compile Optional<GPRTemporary> since r278035 because GPRTemporary has non-const copy constructor
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: JavaScriptCoreAssignee: Fujii Hironori <Hironori.Fujii>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, darin, ews-watchlist, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 211674    
Bug Blocks:    
Attachments:
Description Flags
WIP patch
none
Patch none

Description Fujii Hironori 2021-05-25 17:11:51 PDT
include\optional(95,5): error: the parameter for this explicitly-defaulted copy constructor is const, but a member or base requires it to be non-const

Since r278035 (238131@main)
WinCairo Debug clang-cl can't compile.
WinCairo Release clang-cl and MSVC can compile.


[800/5730] Building CXX object Source\JavaScriptCore\CMakeFiles\JavaScriptCore.dir\dfg\DFGSpeculativeJIT64.cpp.obj
FAILED: Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/dfg/DFGSpeculativeJIT64.cpp.obj 
C:\PROGRA~1\LLVM\bin\clang-cl.exe  /nologo -TP -DBUILDING_JavaScriptCore -DBUILDING_WITH_CMAKE=1 -DHAVE_CONFIG_H=1 -DJavaScriptCore_EXPORTS -DNOCRYPT -DNOMINMAX -DUNICODE -DWINVER=0x601 -DWTF_PLATFORM_WIN_CAIRO=1 -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_UNICODE -D_WIN32_WINNT=0x601 -D_WINDOWS -D_WINSOCKAPI_="" -IJavaScriptCore\Headers -I. -I..\..\Source\JavaScriptCore -I..\..\Source\JavaScriptCore\API -I..\..\Source\JavaScriptCore\assembler -I..\..\Source\JavaScriptCore\b3 -I..\..\Source\JavaScriptCore\b3\air -I..\..\Source\JavaScriptCore\bindings -I..\..\Source\JavaScriptCore\builtins -I..\..\Source\JavaScriptCore\bytecode -I..\..\Source\JavaScriptCore\bytecompiler -I..\..\Source\JavaScriptCore\dfg -I..\..\Source\JavaScriptCore\disassembler -I..\..\Source\JavaScriptCore\disassembler\ARM64 -I..\..\Source\JavaScriptCore\disassembler\udis86 -I..\..\Source\JavaScriptCore\domjit -I..\..\Source\JavaScriptCore\ftl -I..\..\Source\JavaScriptCore\heap -I..\..\Source\JavaScriptCore\debugger -I..\..\Source\JavaScriptCore\inspector -I..\..\Source\JavaScriptCore\inspector\agents -I..\..\Source\JavaScriptCore\inspector\augmentable -I..\..\Source\JavaScriptCore\inspector\remote -I..\..\Source\JavaScriptCore\interpreter -I..\..\Source\JavaScriptCore\jit -I..\..\Source\JavaScriptCore\llint -I..\..\Source\JavaScriptCore\parser -I..\..\Source\JavaScriptCore\profiler -I..\..\Source\JavaScriptCore\runtime -I..\..\Source\JavaScriptCore\tools -I..\..\Source\JavaScriptCore\wasm -I..\..\Source\JavaScriptCore\wasm\js -I..\..\Source\JavaScriptCore\yarr -IJavaScriptCore\DerivedSources -IJavaScriptCore\DerivedSources\inspector -IJavaScriptCore\DerivedSources\runtime -IJavaScriptCore\DerivedSources\yarr -I..\include\private -I..\..\Source\JavaScriptCore\inspector\remote\socket -IWTF\Headers -imsvc ..\..\WebKitLibraries\win\include /W4 -fdiagnostics-color=always -fcolor-diagnostics -Wno-noexcept-type -Wno-psabi -Wno-misleading-indentation -Wno-parentheses-equality -Qunused-arguments -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wno-unknown-argument -Wno-nonportable-include-path -Wno-unknown-pragmas -Wno-macro-redefined -Wno-undef /DWIN32 /D_WINDOWS  /GR- /EHsc- -fno-strict-aliasing /MD /Zi /Ob0 /Od /RTC1 /wd4018 /wd4060 /wd4068 /wd4100 /wd4127 /wd4146 /wd4189 /wd4201 /wd4244 /wd4245 /wd4251 /wd4275 /wd4267 /wd4305 /wd4309 /wd4312 /wd4324 /wd4389 /wd4456 /wd4457 /wd4458 /wd4459 /wd4505 /wd4611 /wd4646 /wd4701 /wd4702 /wd4706 /wd4715 /wd4722 /wd4838 /wd4840 /wd4996 /wd5205 /Zi /GS /EHa- /EHc- /EHs- /fp:except- /analyze- /bigobj /utf-8 /validate-charset -fmsc-version=1911 -ffp-contract=off -fno-slp-vectorize -std:c++17 /showIncludes /FoSource\JavaScriptCore\CMakeFiles\JavaScriptCore.dir\dfg\DFGSpeculativeJIT64.cpp.obj /FdSource\JavaScriptCore\CMakeFiles\JavaScriptCore.dir\ -c -- ..\..\Source\JavaScriptCore\dfg\DFGSpeculativeJIT64.cpp
In file included from ..\..\Source\JavaScriptCore\dfg\DFGSpeculativeJIT64.cpp:27:
In file included from ..\..\Source\JavaScriptCore\dfg/DFGSpeculativeJIT.h:30:
In file included from ..\..\Source\JavaScriptCore\heap/BlockDirectory.h:29:
In file included from ..\..\Source\JavaScriptCore\heap/BlockDirectoryBits.h:29:
In file included from WTF\Headers\wtf/FastBitVector.h:31:
In file included from WTF\Headers\wtf/PrintStream.h:31:
In file included from WTF\Headers\wtf/Forward.h:24:
In file included from WTF\Headers\wtf/Optional.h:23:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include\optional(95,5): error: the parameter for this explicitly-defaulted copy constructor is const, but a member or base requires it to be non-const
    _Optional_destruct_base(const _Optional_destruct_base&) = default;
    ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include\optional(109,35): note: in instantiation of template class 'std::_Optional_destruct_base<JSC::DFG::GPRTemporary, false>' requested here
struct _Optional_construct_base : _Optional_destruct_base<_Ty> {
                                  ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include\xsmf_control.h(46,28): note: in instantiation of template class 'std::_Optional_construct_base<JSC::DFG::GPRTemporary>' requested here
struct _Non_trivial_move : _SMF_control_copy<_Base, _Types...> { // non-trivial move construction facade
                           ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include\xsmf_control.h(85,31): note: in instantiation of template class 'std::_Non_trivial_move<std::_Optional_construct_base<JSC::DFG::GPRTemporary>, JSC::DFG::GPRTemporary>' requested here
struct _Deleted_copy_assign : _SMF_control_move<_Base, _Types...> { // deleted copy assignment facade
                              ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include\xsmf_control.h(107,35): note: in instantiation of template class 'std::_Deleted_copy_assign<std::_Optional_construct_base<JSC::DFG::GPRTemporary>, JSC::DFG::GPRTemporary>' requested here
struct _Non_trivial_move_assign : _SMF_control_copy_assign<_Base, _Types...> { // non-trivial move assignment facade
                                  ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include\optional(154,26): note: in instantiation of template class 'std::_Non_trivial_move_assign<std::_Optional_construct_base<JSC::DFG::GPRTemporary>, JSC::DFG::GPRTemporary>' requested here
class optional : private _SMF_control<_Optional_construct_base<_Ty>, _Ty> {
                         ^
..\..\Source\JavaScriptCore\dfg\DFGSpeculativeJIT64.cpp(1935,32): note: in instantiation of template class 'std::optional<JSC::DFG::GPRTemporary>' requested here
        Optional<GPRTemporary> scratch;
                               ^
1 error generated.
Comment 1 Fujii Hironori 2021-05-25 17:15:32 PDT
(In reply to Fujii Hironori from comment #0)
> WinCairo Debug clang-cl can't compile.
> WinCairo Release clang-cl and MSVC can compile.

Wrong. WinCairo Release clang-cl can't compile.
clang-cl can't compile while MSVC can.
Comment 2 Fujii Hironori 2021-05-25 17:46:14 PDT
This?

c++ - When are special member functions of a template class instantiated? - Stack Overflow
https://stackoverflow.com/q/10370713
Comment 3 Fujii Hironori 2021-05-25 17:47:20 PDT
Created attachment 429718 [details]
WIP patch
Comment 4 Chris Dumez 2021-05-25 17:47:36 PDT
Have you tried replacing:
GPRTemporary(GPRTemporary& other) = delete;

with:
GPRTemporary(const GPRTemporary& other) = delete;

?
Comment 5 Chris Dumez 2021-05-25 17:48:06 PDT
Comment on attachment 429718 [details]
WIP patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429718&action=review

> Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:2030
> +    GPRTemporary(GPRTemporary&) = delete;
>  

Do we need both?
Comment 6 Fujii Hironori 2021-05-25 17:51:03 PDT
Comment on attachment 429718 [details]
WIP patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429718&action=review

>> Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:2030
>>  
> 
> Do we need both?

Oh, no I don't. Thanks.
Comment 7 Fujii Hironori 2021-05-25 18:24:31 PDT
Created attachment 429723 [details]
Patch
Comment 8 Chris Dumez 2021-05-25 18:25:07 PDT
Comment on attachment 429723 [details]
Patch

r=me if the bots are happy.
Comment 9 EWS 2021-05-25 20:31:54 PDT
Committed r278073 (238152@main): <https://commits.webkit.org/238152@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 429723 [details].
Comment 10 Radar WebKit Bug Importer 2021-05-25 20:32:17 PDT
<rdar://problem/78492076>