[Webkit-unassigned] [Bug 281994] New: Add static_assert to spanReinterpretCast<>() to prevent unnecessary casts

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 23 10:40:46 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=281994

            Bug ID: 281994
           Summary: Add static_assert to spanReinterpretCast<>() to
                    prevent unnecessary casts
           Product: WebKit
           Version: Other
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ddkilzer at webkit.org

Add static_assert to spanReinterpretCast<>() to prevent unnecessary casts.

Idea from Darin Adler here: <https://github.com/WebKit/WebKit/pull/35601#discussion_r1811793553>

This was seen once in Source/WTF/wtf/text/AtomStringImpl.cpp prior to fixing Bug 281944:

```
RefPtr<AtomStringImpl> AtomStringImpl::add(std::span<const char8_t> characters)
{
    HashedUTF8Characters buffer { characters, computeUTF16LengthWithHash(spanReinterpretCast<const char8_t>(characters)) };
    [...]
```

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20241023/403a141f/attachment.htm>


More information about the webkit-unassigned mailing list