Skip to content

Commit e7d2725

Browse files
committed
Enforce arithmetic types
1 parent 519399f commit e7d2725

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

tools/clang/unittests/HLSLExec/ExecutionTest.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -805,14 +805,18 @@ class ExecutionTest {
805805
const char *pShaderModelStr, const char *pShader,
806806
Ty *pInputDataPairs, unsigned inputDataCount);
807807

808-
template <typename T, std::size_t N>
809-
//typename = std::enable_if_t<std::is_arithmetic_v<T>>>
808+
template <typename T, std::size_t N,
809+
typename = std::enable_if_t<std::is_arithmetic_v<T>>>
810+
// By checking that T is an arithmetic we can keep the compiler error messages
811+
// from misusing the template much cleaner.
810812
void LongVectorBinaryOpTestBase();
811813
template <typename T>
812814
void LongVectorBinaryOpTestBase();
813815

814-
template <typename T, std::size_t N>
815-
//typename = std::enable_if_t<std::is_arithmetic_v<T>>>
816+
template <typename T, std::size_t N,
817+
typename = std::enable_if_t<std::is_arithmetic_v<T>>>
818+
// By checking that T is an arithmetic we can keep the compiler error messages
819+
// from misusing the template much cleaner.
816820
void LongVectorUnaryOpTestBase();
817821
template <typename T>
818822
void LongVectorUnaryOpTestBase();
@@ -11229,7 +11233,9 @@ TEST_F(ExecutionTest, PackUnpackTest) {
1122911233
// before checking in PR.
1123011234
// SLongVectorBinaryOp is used in ShaderOpArithTable.xml. The shader program
1123111235
// uses the struct defintion to read from the input global buffer.
11232-
template <typename T, std::size_t N = 4,
11236+
template <typename T, std::size_t N,
11237+
// By checking that T is an arithmetic we can keep the compiler error messages
11238+
// from misusing the template much cleaner.
1123311239
typename = std::enable_if_t<std::is_arithmetic_v<T>>>
1123411240
struct SLongVectorBinaryOp {
1123511241
T scalarInput;
@@ -11668,8 +11674,10 @@ void ExecutionTest::LongVectorUnaryOpTestBase() {
1166811674
LongVectorUnaryOpTestBase<T, 1024>();
1166911675
}
1167011676

11671-
template <typename T, std::size_t N>
11672-
//typename = std::enable_if_t<std::is_arithmetic_v<T>>>
11677+
template <typename T, std::size_t N,
11678+
// By checking that T is an arithmetic we can keep the compiler error messages
11679+
// from misusing the template much cleaner.
11680+
typename = std::enable_if_t<std::is_arithmetic_v<T>>>
1167311681
void ExecutionTest::LongVectorUnaryOpTestBase() {
1167411682
WEX::TestExecution::SetVerifyOutput verifySettings(
1167511683
WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);

0 commit comments

Comments
 (0)