mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 10:19:20 +00:00
LibWeb/DOM: Work around GCC 14 warning on always true is<T>()
GCC 14 emits a warning when an always succeeding `dynamic_cast`'s return value is compared to NULL inside the `AK::is<T>(U)` template when `T` == `U`. While warning on tautological `is` calls seems useful, it's a bit awkward when it comes from a function template where the cast may fail in some instantiation. There is a GCC bug open for it: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664 Work around the warning by performing the algorithm on the base type (`EventTarget`), with a wrapper that casts it to the more specialized input type.
This commit is contained in:
parent
ea67bc989f
commit
31eb0ed938
Notes:
sideshowbarker
2024-07-19 21:36:17 +09:00
Author: https://github.com/BertalanD
Commit: 31eb0ed938
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/706
1 changed files with 8 additions and 2 deletions
|
@ -13,8 +13,7 @@
|
|||
namespace Web::DOM {
|
||||
|
||||
// https://dom.spec.whatwg.org/#retarget
|
||||
template<typename T>
|
||||
T* retarget(T* a, T* b)
|
||||
inline EventTarget* retarget_impl(EventTarget* a, EventTarget* b)
|
||||
{
|
||||
// To retarget an object A against an object B, repeat these steps until they return an object:
|
||||
for (;;) {
|
||||
|
@ -39,4 +38,11 @@ T* retarget(T* a, T* b)
|
|||
}
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#retarget
|
||||
template<typename T>
|
||||
T* retarget(T* a, T* b)
|
||||
{
|
||||
return static_cast<T*>(retarget_impl(a, b));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue