[webkit-reviews] review granted: [Bug 226161] typo in `Optional<T&>::value() const` prevents usage of `Optional<const T&>` : [Attachment 429503] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun May 23 22:53:28 PDT 2021


Darin Adler <darin at apple.com> has granted Cameron McCormack (:heycam)
<heycam at apple.com>'s request for review:
Bug 226161: typo in `Optional<T&>::value() const` prevents usage of
`Optional<const T&>`
https://bugs.webkit.org/show_bug.cgi?id=226161

Attachment 429503: Patch

https://bugs.webkit.org/attachment.cgi?id=429503&action=review




--- Comment #6 from Darin Adler <darin at apple.com> ---
Comment on attachment 429503
  --> https://bugs.webkit.org/attachment.cgi?id=429503
Patch

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

>> Tools/TestWebKitAPI/Tests/WTF/Optional.cpp:253
>> +	    Optional<int&> optional { x };
> 
> In all the places where you want to use an optional reference, you should
just be using a pointer instead. You shouldn't have hit this problem in the
first place.

I agree with this comment. As a style choice we encourage continuing to use
pointers for optional references.


More information about the webkit-reviews mailing list