Bug 281994
| Summary: | Add static_assert to spanReinterpretCast<>() to prevent unnecessary casts | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | David Kilzer (:ddkilzer) <ddkilzer> |
| Component: | Web Template Framework | Assignee: | David Kilzer (:ddkilzer) <ddkilzer> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Other | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=281944 | ||
David Kilzer (:ddkilzer)
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)) };
[...]
```
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/138491814>
David Kilzer (:ddkilzer)
Pull request: https://github.com/WebKit/WebKit/pull/35638
EWS
Committed 285623@main (4543cc7cb73c): <https://commits.webkit.org/285623@main>
Reviewed commits have been landed. Closing PR #35638 and removing active labels.