Skip to content

Commit d6e0ca4

Browse files
authored
Clang - Fix use of overloaded operator '+' is ambiguous error (#8516)
## Why Resolve the error that shows up when compiled with Clang version 22.1.2 and newer: `"use of overloaded operator '+' is ambiguous."`. ## What Cast each literal to T (+ T(2.0f), + T(0.0f), + T(4.0f), + T(6.0f)) so the addend has the same type as the operand. This removes the overload ambiguity without changing the values being tested. ## Validation Validated locally in the OS.2020 that all related errors dropped in Clang build.
1 parent 8ed7088 commit d6e0ca4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tools/clang/unittests/HLSLExec/LongVectors.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,14 +1349,14 @@ template <typename T> struct ExpectedBuilder<OpType::ModF, T> {
13491349
// The value of A in each lane is computed by : A = A + LaneID*2
13501350
//
13511351
// Top right (lane 1) - Top Left (lane 0)
1352-
DEFAULT_OP_1(OpType::DerivativeDdx, ((A + 2) - (A + 0)));
1352+
DEFAULT_OP_1(OpType::DerivativeDdx, ((A + T(2.0f)) - (A + T(0.0f))));
13531353
// Lower left (lane 2) - Top Left (lane 0)
1354-
DEFAULT_OP_1(OpType::DerivativeDdy, ((A + 4) - (A + 0)));
1354+
DEFAULT_OP_1(OpType::DerivativeDdy, ((A + T(4.0f)) - (A + T(0.0f))));
13551355

13561356
// Bottom right (lane 3) - Bottom left (lane 2)
1357-
DEFAULT_OP_1(OpType::DerivativeDdxFine, ((A + 6) - (A + 4)));
1357+
DEFAULT_OP_1(OpType::DerivativeDdxFine, ((A + T(6.0f)) - (A + T(4.0f))));
13581358
// Bottom right (lane 3) - Top right (lane 1)
1359-
DEFAULT_OP_1(OpType::DerivativeDdyFine, ((A + 6) - (A + 2)));
1359+
DEFAULT_OP_1(OpType::DerivativeDdyFine, ((A + T(6.0f)) - (A + T(2.0f))));
13601360

13611361
//
13621362
// Quad Read Ops

0 commit comments

Comments
 (0)