Bug 234546

Summary: MSVC reports "SVGPropertyAnimator.h(94): error C2839: invalid return type 'T *' for overloaded 'operator ->'" with /std:c++20
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: Tools / TestsAssignee: Fujii Hironori <Hironori.Fujii>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, darin, dino, don.olmstead, ews-watchlist, fmalita, gyuyoung.kim, pdr, sabouhallawa, schenney, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=233963
Bug Depends on:    
Bug Blocks: 233448    
Attachments:
Description Flags
Patch
none
Patch for landing
none
Patch none

Description Fujii Hironori 2021-12-20 21:30:56 PST
MSVC reports "SVGPropertyAnimator.h(94): error C2839: invalid return type 'T *' for overloaded 'operator ->'" with /std:c++20

> Source\WebCore\svg\properties\SVGPropertyAnimator.h(94): error C2839: invalid return type 'T *' for overloaded 'operator ->'
> Source\WebCore\svg\properties\SVGPropertyAnimator.h(102): note: see reference to class template instantiation 'WebCore::SVGPropertyAnimator<AnimationFunction>' being compiled
> Source\WebCore\svg\properties\SVGPropertyAnimator.h(94): error C2039: 'isSVGElement': is not a member of 'WTF::RefPtr'
Comment 1 Fujii Hironori 2021-12-20 21:37:59 PST
Created attachment 447688 [details]
Patch
Comment 2 Alex Christensen 2021-12-20 22:46:33 PST
Comment on attachment 447688 [details]
Patch

auto*
Comment 3 Fujii Hironori 2021-12-20 23:17:27 PST
Created attachment 447691 [details]
Patch for landing

Thank you for the review.
Comment 4 EWS 2021-12-21 00:30:11 PST
Committed r287300 (245452@main): <https://commits.webkit.org/245452@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 447691 [details].
Comment 5 Radar WebKit Bug Importer 2021-12-21 00:31:19 PST
<rdar://problem/86757805>
Comment 6 Darin Adler 2021-12-21 01:05:33 PST
Comment on attachment 447691 [details]
Patch for landing

This change is going in the opposite direction that our future code is going. Taking out the use of RefPtr because we know nothing is done between the call to parentElement and the call to computeCSSPropertyValue is absolutely *not* the theme of our modern code.

Why does the use of RefPtr here not compile? We need to fix that, not remove smart pointers. To move in the direction of more secure code, we need to move to always using smart pointers for local variables.
Comment 7 Fujii Hironori 2021-12-21 02:25:44 PST
Thank you for the feedback. Reopened.
Comment 8 Alex Christensen 2021-12-21 15:07:06 PST
I agree with Darin's feedback.
Comment 9 Fujii Hironori 2021-12-23 13:02:15 PST
I created a repro and reported the bug to MSVC team.
https://developercommunity.visualstudio.com/t/error-c2839-invalid-return-type-t-for-overloaded-o/1620672
Comment 10 Don Olmstead 2021-12-24 19:24:50 PST
Fujii just provide the full templated type here. Look at my WIP patch for the /permissive- to see what got me past this error
Comment 11 Fujii Hironori 2021-12-26 13:06:17 PST
Yup. Your workaround seems the best (attachment 445038 [details]). I just wanted to confirm that this is MSVC bug and let them know before preparing a patch for WebKit.
Comment 12 Fujii Hironori 2022-02-01 13:35:29 PST
Created attachment 450563 [details]
Patch
Comment 13 EWS 2022-02-01 14:49:05 PST
Committed r288913 (246653@main): <https://commits.webkit.org/246653@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450563 [details].