Source code

Revision control

Copy as Markdown

Other Tools

From 7d2c9cb7d614c148c18299b1cad40d18f896ee27 Mon Sep 17 00:00:00 2001
From: Bob Hood <bhood@mozilla.com>
Date: Mon, 17 Aug 2026 11:58:51 -0600
Subject: [PATCH] Avoid implicit StrictNumeric conversion in a new[] size
expression
CheckedNumeric::ValueOrDie() returns StrictNumeric<Dst>, whose conversion to
Dst is a template with a deduced parameter. GCC cannot deduce it when the value
is used as the size expression of a new[], failing with:
error: default type conversion cannot deduce template argument for
'template<class Dst, ...> constexpr StrictNumeric<T>::operator Dst() const'
Note that spelling out ValueOrDie's own template argument does not help, since
the unconvertible value is its StrictNumeric return type rather than the call
itself. Cast explicitly instead, which gives the conversion operator a concrete
destination type.
Compile-only change; checkedArraySize is already a CheckedNumeric<size_t>.
---
src/compiler/translator/IntermNode.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compiler/translator/IntermNode.cpp b/src/compiler/translator/IntermNode.cpp
index 5189d334c..60375246e 100644
--- a/src/compiler/translator/IntermNode.cpp
+++ b/src/compiler/translator/IntermNode.cpp
@@ -881,7 +881,7 @@ const TConstantUnion *TIntermAggregate::getConstantValue() const
angle::base::CheckedNumeric<size_t> checkedArraySize = elementSize;
checkedArraySize *= getOutermostArraySize();
- constArray = new TConstantUnion[checkedArraySize.ValueOrDie()];
+ constArray = new TConstantUnion[static_cast<size_t>(checkedArraySize.ValueOrDie())];
size_t elementOffset = 0u;
for (TIntermNode *constructorArg : mArguments)
--
2.43.0