Skip to content

Commit c5ab3e4

Browse files
stha09V8 LUCI CQ
authored andcommitted
libstdc++: fix incomplete type in v8::internal::is_subtype<T, U>
Using std::convertible with incomplete types is UB. However, till GCC 12 it was accepted and std::convertible returned false. This fails now for e.g. v8::internal::WasmArray. Use std::disjunction and std::conjunction instead which are short- circuiting, because std::is_base_of<T, T> is already true. Bug: chromium:957519 Change-Id: Ia26643dbdf0fb00d5586c71ae6b18e8d0f3cf96e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4394663 Commit-Queue: Stephan Hartmann <[email protected]> Reviewed-by: Clemens Backes <[email protected]> Cr-Commit-Position: refs/heads/main@{#86904}
1 parent cc87750 commit c5ab3e4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/codegen/tnode.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,9 @@ using BuiltinPtr = Smi;
270270
template <class T, class U>
271271
struct is_subtype {
272272
static const bool value =
273-
std::is_base_of<U, T>::value || (std::is_same<U, MaybeObject>::value &&
274-
std::is_convertible<T, Object>::value);
273+
std::disjunction<std::is_base_of<U, T>,
274+
std::conjunction<std::is_same<U, MaybeObject>,
275+
std::is_convertible<T, Object>>>::value;
275276
};
276277
template <class T1, class T2, class U>
277278
struct is_subtype<UnionT<T1, T2>, U> {

0 commit comments

Comments
 (0)