Bug 176381 - [Win] Compile errors in Document::updateTitleElement.
Summary: [Win] Compile errors in Document::updateTitleElement.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-05 10:35 PDT by Per Arne Vollan
Modified: 2017-09-11 12:39 PDT (History)
10 users (show)

See Also:


Attachments
Patch (3.66 KB, patch)
2017-09-05 11:01 PDT, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (3.67 KB, patch)
2017-09-05 11:09 PDT, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (3.03 KB, patch)
2017-09-06 10:01 PDT, Per Arne Vollan
achristensen: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2017-09-05 10:35:54 PDT
c:\cygwin\home\buildbot\slave\win-release\build\source\webcore\dom\Document.cpp(1570): error C2446: ':': no conversion from 'WebCore::Document::updateTitleElement::<lambda_16b62001404c23de7212dde0d19dd8c0>' to 'WebCore::Document::updateTitleElement::<lambda_8c64903d313d33c5fcf4c4945dc4e7bd>' (compiling source file C:\cygwin\home\buildbot\slave\win-release\build\Source\WebCore\dom\DOMAllInOne.cpp) [C:\cygwin\home\buildbot\slave\win-release\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
  c:\cygwin\home\buildbot\slave\win-release\build\source\webcore\dom\Document.cpp(1570): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called (compiling source file C:\cygwin\home\buildbot\slave\win-release\build\Source\WebCore\dom\DOMAllInOne.cpp)
c:\cygwin\home\buildbot\slave\win-release\build\source\webcore\dom\Document.cpp(1571): error C2446: ':': no conversion from 'WebCore::Document::updateTitleElement::<lambda_b90aca9775183a3a847bb0f92fa5dde7>' to 'WebCore::Document::updateTitleElement::<lambda_5bf19252f147055cda21dc9527885b1b>' (compiling source file C:\cygwin\home\buildbot\slave\win-release\build\Source\WebCore\dom\DOMAllInOne.cpp) [C:\cygwin\home\buildbot\slave\win-release\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
  c:\cygwin\home\buildbot\slave\win-release\build\source\webcore\dom\Document.cpp(1571): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called (compiling source file C:\cygwin\home\buildbot\slave\win-release\build\Source\WebCore\dom\DOMAllInOne.cpp)
c:\cygwin\home\buildbot\slave\win-release\build\source\webcore\dom\Document.cpp(1572): error C2446: ':': no conversion from 'WebCore::Document::updateTitleElement::<lambda_7d10b9bb64b9bf807f86fa41f4b56cfc>' to 'WebCore::Document::updateTitleElement::<lambda_a2b965e941c6d63acb9048aedb2d8536>' (compiling source file C:\cygwin\home\buildbot\slave\win-release\build\Source\WebCore\dom\DOMAllInOne.cpp) [C:\cygwin\home\buildbot\slave\win-release\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
  c:\cygwin\home\buildbot\slave\win-release\build\source\webcore\dom\Document.cpp(1572): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called (compiling source file C:\cygwin\home\buildbot\slave\win-release\build\Source\WebCore\dom\DOMAllInOne.cpp)
c:\cygwin\home\buildbot\slave\win-release\build\source\webcore\dom\Document.cpp(1574): error C2064: term does not evaluate to a function taking 1 arguments (compiling source file C:\cygwin\home\buildbot\slave\win-release\build\Source\WebCore\dom\DOMAllInOne.cpp) [C:\cygwin\home\buildbot\slave\win-release\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
c:\cygwin\home\buildbot\slave\win-release\build\source\webcore\dom\Document.cpp(1581): error C2064: term does not evaluate to a function taking 1 arguments (compiling source file C:\cygwin\home\buildbot\slave\win-release\build\Source\WebCore\dom\DOMAllInOne.cpp) [C:\cygwin\home\buildbot\slave\win-release\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
c:\cygwin\home\buildbot\slave\win-release\build\source\webcore\dom\Document.cpp(1585): error C2064: term does not evaluate to a function taking 1 arguments (compiling source file C:\cygwin\home\buildbot\slave\win-release\build\Source\WebCore\dom\DOMAllInOne.cpp) [C:\cygwin\home\buildbot\slave\win-release\build\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
Comment 1 Per Arne Vollan 2017-09-05 11:01:19 PDT
Created attachment 319915 [details]
Patch
Comment 2 Per Arne Vollan 2017-09-05 11:09:24 PDT
Created attachment 319916 [details]
Patch
Comment 3 Per Arne Vollan 2017-09-05 11:21:23 PDT
This has already been fixed.
Comment 4 Per Arne Vollan 2017-09-06 09:12:20 PDT
I am seeing this compile error again, now.
Comment 5 Darin Adler 2017-09-06 09:34:34 PDT
Comment on attachment 319916 [details]
Patch

This change makes things less efficient and less elegant. But maybe there is no other way to work around the limitations of the Windows compiler.
Comment 6 Darin Adler 2017-09-06 09:36:50 PDT
Comment on attachment 319916 [details]
Patch

A better way to work around this unfortunate limitation of the Windows compiler it is to convert all 6 of the lambdas into plain old functions, outside Document::updateTitleElement, just local functions like:

    static Element* findHTMLTitle(Document& document)
    {
    }
Comment 7 Per Arne Vollan 2017-09-06 09:49:08 PDT
(In reply to Darin Adler from comment #6)
> Comment on attachment 319916 [details]
> Patch
> 
> A better way to work around this unfortunate limitation of the Windows
> compiler it is to convert all 6 of the lambdas into plain old functions,
> outside Document::updateTitleElement, just local functions like:
> 
>     static Element* findHTMLTitle(Document& document)
>     {
>     }

Thanks for reviewing! I will update the patch.
Comment 8 Per Arne Vollan 2017-09-06 10:01:38 PDT
Created attachment 320034 [details]
Patch
Comment 9 Alex Christensen 2017-09-06 10:26:21 PDT
Comment on attachment 320034 [details]
Patch

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

> Source/WebCore/dom/Document.cpp:1567
> +static bool isSVGTitle(Element& element)
> +{
> +    return is<SVGTitleElement>(element);

Can we not just use is<SVGTitleElement> where we use isSVGTitle instead of making a wrapper?  Same with isHTMLTitle
Comment 10 Per Arne Vollan 2017-09-06 10:49:03 PDT
Committed r221684: <https://trac.webkit.org/changeset/221684/webkit>
Comment 11 Per Arne Vollan 2017-09-06 10:57:02 PDT
(In reply to Alex Christensen from comment #9)
> Comment on attachment 320034 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=320034&action=review
> 
> > Source/WebCore/dom/Document.cpp:1567
> > +static bool isSVGTitle(Element& element)
> > +{
> > +    return is<SVGTitleElement>(element);
> 
> Can we not just use is<SVGTitleElement> where we use isSVGTitle instead of
> making a wrapper?  Same with isHTMLTitle

isSVGTitle and isHTMLTitle is only used when assigning one of the function pointers to a local variable, I don't think we can use is<SVGTitleElement> there, if I understand you correctly?

Thanks for reviewing!
Comment 12 Darin Adler 2017-09-06 15:44:44 PDT
Comment on attachment 320034 [details]
Patch

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

>>> Source/WebCore/dom/Document.cpp:1567
>>> +    return is<SVGTitleElement>(element);
>> 
>> Can we not just use is<SVGTitleElement> where we use isSVGTitle instead of making a wrapper?  Same with isHTMLTitle
> 
> isSVGTitle and isHTMLTitle is only used when assigning one of the function pointers to a local variable, I don't think we can use is<SVGTitleElement> there, if I understand you correctly?
> 
> Thanks for reviewing!

I think we can use is<SVGTitleElement> and is<HTMLTitleElement>. Those are functions--template functions are functions--and can be turned into function pointers. Did you try it?
Comment 13 Per Arne Vollan 2017-09-06 16:00:56 PDT
(In reply to Darin Adler from comment #12)
> Comment on attachment 320034 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=320034&action=review
> 
> >>> Source/WebCore/dom/Document.cpp:1567
> >>> +    return is<SVGTitleElement>(element);
> >> 
> >> Can we not just use is<SVGTitleElement> where we use isSVGTitle instead of making a wrapper?  Same with isHTMLTitle
> > 
> > isSVGTitle and isHTMLTitle is only used when assigning one of the function pointers to a local variable, I don't think we can use is<SVGTitleElement> there, if I understand you correctly?
> > 
> > Thanks for reviewing!
> 
> I think we can use is<SVGTitleElement> and is<HTMLTitleElement>. Those are
> functions--template functions are functions--and can be turned into function
> pointers. Did you try it?

Yes, I tried it, but this also gave compile errors. MSVC was not able to resolve, since is<> has several overloads.
Comment 14 Darin Adler 2017-09-07 08:56:06 PDT
I thought of another way to write this that would be slightly more elegant. Working on a patch for that.
Comment 15 Per Arne Vollan 2017-09-11 12:39:03 PDT
<rdar://problem/34373638>