Bug 189987

Summary: [Win] error C2139: 'WebKit::UpdateInfo': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_assignable'
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: andersca, annulen, bfulgham, chris.reid, don.olmstead, mark.salisbury, todd, vonreth
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 192295, 189467    
Attachments:
Description Flags
repro
none
WIP patch
none
Patch none

Fujii Hironori
Reported 2018-09-25 21:48:34 PDT
[Win] error C2139: 'WebKit::UpdateInfo': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_assignable' Visual Studio 2017 version 15.8.5 can't compile WebKit. > 37>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\type_traits(912): error C2139: 'WebKit::UpdateInfo': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_assignable' (compiling source file C:\webkit\ga\Source\WebKit\UIProcess\AcceleratedDrawingAreaProxy.cpp) > 37>c:\webkit\ga\webkitbuild\debug\derivedsources\webkit\drawingareaproxymessages.h(37): note: see declaration of 'WebKit::UpdateInfo' (compiling source file C:\webkit\ga\Source\WebKit\UIProcess\AcceleratedDrawingAreaProxy.cpp) > 37>c:\webkit\ga\webkitbuild\debug\derivedsources\webkit\drawingareaproxymessages.h(69): note: see reference to class template instantiation 'std::is_move_assignable<const WebKit::UpdateInfo &>' being compiled (compiling source file C:\webkit\ga\Source\WebKit\UIProcess\AcceleratedDrawingAreaProxy.cpp) > 37>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\type_traits(912): note: see reference to variable template 'const bool conjunction_v<std::is_move_assignable<unsigned __int64>,std::is_move_assignable<WebKit::UpdateInfo const &> >' being compiled (compiling source file C:\webkit\ga\Source\WebKit\UIProcess\AcceleratedDrawingAreaProxy.cpp) > 37>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\type_traits(901): error C2139: 'WebKit::UpdateInfo': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_assignable' (compiling source file C:\webkit\ga\Source\WebKit\UIProcess\AcceleratedDrawingAreaProxy.cpp) > 37>c:\webkit\ga\webkitbuild\debug\derivedsources\webkit\drawingareaproxymessages.h(37): note: see declaration of 'WebKit::UpdateInfo' (compiling source file C:\webkit\ga\Source\WebKit\UIProcess\AcceleratedDrawingAreaProxy.cpp) > 37>c:\webkit\ga\webkitbuild\debug\derivedsources\webkit\drawingareaproxymessages.h(69): note: see reference to class template instantiation 'std::is_copy_assignable<const WebKit::UpdateInfo &>' being compiled (compiling source file C:\webkit\ga\Source\WebKit\UIProcess\AcceleratedDrawingAreaProxy.cpp) > 37>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726\include\type_traits(901): note: see reference to variable template 'const bool conjunction_v<std::is_copy_assignable<unsigned __int64>,std::is_copy_assignable<WebKit::UpdateInfo const &> >' being compiled (compiling source file C:\webkit\ga\Source\WebKit\UIProcess\AcceleratedDrawingAreaProxy.cpp)
Attachments
repro (297 bytes, text/plain)
2018-09-25 22:19 PDT, Fujii Hironori
no flags
WIP patch (4.77 KB, patch)
2018-10-09 02:10 PDT, Fujii Hironori
no flags
Patch (11.12 KB, patch)
2019-01-14 12:06 PST, Don Olmstead
no flags
Fujii Hironori
Comment 1 2018-09-25 22:19:40 PDT
Created attachment 350848 [details] repro > C:\home>cl /c a.cpp > Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26730 for x64 > Copyright (C) Microsoft Corporation. All rights reserved. > > a.cpp > C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\include\type_traits(912): error C2139: 'WebKit::UpdateInfo': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_assignable' > a.cpp(5): note: see declaration of 'WebKit::UpdateInfo' > a.cpp(19): note: see reference to class template instantiation 'std::is_move_assignable<_This>' being compiled > with > [ > _This=const WebKit::UpdateInfo & > ] > C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\include\type_traits(912): note: see reference to variable template 'const bool conjunction_v<std::is_move_assignable<WebKit::UpdateInfo const &> >' being compiled > C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\include\type_traits(901): error C2139: 'WebKit::UpdateInfo': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_assignable' > a.cpp(5): note: see declaration of 'WebKit::UpdateInfo' > a.cpp(19): note: see reference to class template instantiation 'std::is_copy_assignable<_This>' being compiled > with > [ > _This=const WebKit::UpdateInfo & > ] > C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726\include\type_traits(901): note: see reference to variable template 'const bool conjunction_v<std::is_copy_assignable<WebKit::UpdateInfo const &> >' being compiled > > C:\home>
Todd Morrison
Comment 3 2018-09-28 18:01:24 PDT
Can confirm that the issue doesn't occur on 15.6-15.7 Build Tools. Prior builds for reproduction can be found at https://docs.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017 Also see prior tags (ex. Safari-607.1.8) failing with the same error on 15.7 Build Tools. This looks like a VS issue, not something in the kit sources.
Todd Morrison
Comment 4 2018-09-28 18:03:24 PDT
Correction: "Also see prior tags (ex. Safari-607.1.8) failing with the same error on 15.8 Build Tools."
Fujii Hironori
Comment 5 2018-10-08 20:39:18 PDT
This is a spec of MSVC. https://developercommunity.visualstudio.com/content/problem/343550/webkit-an-undefined-class-is-not-allowed-as-an-arg.html?childToView=351971#comment-351971 > Thank you for your feedback! We have determined that this issue > is not a bug, but is a consequence of our implementation of the > resolution for LWG defect 2729 and 2958 ( > https://wg21.link/lwg2729 https://wg21.link/lwg2958 ). LWG 2729 > specifies that tuple's copy assignment shall be defined as > deleted unless is_copy_assignable_v holds for all of the tuple's > element types. > > The repro contains a class Update with a non-static data member > of type std::tuple<const WebKit::UpdateInfo&> where > WebKit::UpdateInfo is an incomplete type. When the compiler > generates Update's copy assignment operator, it must determine if > overload resolution to determine the assignment operator used to > copy Update's member of type std::tuple<const > WebKit::UpdateInfo&> "results in an ambiguity or a function that > is deleted or inaccessible from the defaulted assignment > operator" so as to determine if Update's implicitly-defaulted > copy assignment operator should be defined as deleted per C++17 > [class.copy.assign]/7.4. Performing that overload resolution for > std::tuple's copy assignment then necessarily must check the > constraint added by LWG 2729 and determine if > is_copy_assignable_v<const WebKit::UpdateInfo&> holds. > > It's impossible to determine if a reference to an incomplete type > would be assignable if the referenced type were complete: the > fact that this isn't a precondition of the is_XXX_assignable > traits is a defect in the Standard and the subject of LWG 3099 ( > https://wg21.link/lwg3099 ). MSVC chooses to diagnose this > particular precondition violation, some other compilers like to > choose an answer arbitrarily ( https://godbolt.org/z/ao-bUK ), > but in any case the program has undefined behavior.
Fujii Hironori
Comment 6 2018-10-09 02:10:02 PDT
Created attachment 351872 [details] WIP patch
Fujii Hironori
Comment 7 2018-10-17 18:49:25 PDT
If I apply this WIP patch, other issue will rise, which is same with Bug 189467 and Bug 188589 Comment 8. It will be fixed in the upcoming VS. https://developercommunity.visualstudio.com/content/problem/315575/overload-resolution-for-built-in-operator-and-enum.html I need to wait for it.
Don Olmstead
Comment 8 2018-10-22 13:08:33 PDT
This appears to have landed in 15.8.7 according to creid.
Christopher Reid
Comment 9 2018-10-22 18:35:55 PDT
(In reply to Don Olmstead from comment #8) > This appears to have landed in 15.8.7 according to creid. This can be reopened. Somehow it was compiling on Friday with a Visual Studio Community install on a new machine. I now have this issue after installing Professional and making other environment changes.
Fujii Hironori
Comment 10 2018-10-22 18:54:08 PDT
I confirmed VS 2017 version 15.8.7 still has both issues. Reopened.
Fujii Hironori
Comment 11 2018-11-15 21:40:15 PST
Good news! Microsoft finally admits this is a bug. https://developercommunity.visualstudio.com/content/problem/343550/webkit-an-undefined-class-is-not-allowed-as-an-arg.html?childToView=384311#comment-384311 > I've reexamined this problem, and come to the conclusion that I > was wrong to claim this isn't a bug. > > The repro here - and for > https://developercommunity.visualstudio.com/content/problem/383162/stdtuple-compiler-error-for-incomplete-type-refere.html > as well - never ODR-uses the assignment operator of the > tuple-of-reference-to-incomplete-type nor ODR-uses an > implicitly-declared assignment operator of a class with the > tuple-of-reference-to-incomplete-type as a subobject. In short, > the repro shouldn't cause the potentially-deleted assignment > operator to be generated yet the compiler does so anyway. That's > a bug. > > My sincerest apologies for the mistake.
Don Olmstead
Comment 12 2019-01-14 12:06:52 PST
Created attachment 359064 [details] Patch Rebased the WIP patch to latest trunk to see if latest Visual Studio 2017, 15.9.5 toolset works with it, and it does! This patch appears to duplicate a good amount of logic in generate_message_handler. This also means that there are a good amount of headers that are included in the .cpp and the .h. To be fair the original code didn't seem to be too smart about not including headers in the .cpp that are in the .h.
Fujii Hironori
Comment 13 2019-01-16 01:00:43 PST
Don Olmstead
Comment 14 2019-03-04 10:42:48 PST
This is fixed since VS 2019 Update 3. I don't think it'll be back ported to 2017 so we're going to need to move to 2019 shortly after its release in April 2019. Currently its in RC.
Fujii Hironori
Comment 15 2019-04-03 01:57:44 PDT
I confirmed Visual Studio 2019 can compile. Closed this bug.
Konstantin Tokarev
Comment 16 2019-06-26 11:06:15 PDT
I've found a bug in this patch, so if there is any interest in supporting MSVC2017 I can share my solution
Note You need to log in before you can comment on or make changes to this bug.