https://github.com/s-perron updated 
https://github.com/llvm/llvm-project/pull/189089

>From c3b6a5908238c0cce69dfd7e2657c5c614d991b1 Mon Sep 17 00:00:00 2001
From: Steven Perron <[email protected]>
Date: Fri, 27 Mar 2026 14:39:37 -0400
Subject: [PATCH] [HLSL] Fix up Texture2D-mips-errors test

The Texture2D-mips-errors test was supposed to test for an error when the mips
types are used as templates. It was initially disabled because of a
crash. On further investigation, the crash was related to int2(0,0), and
not the mips type.

Follow-up issue for the int2(0,0) crash: #189086

Fixes #188556
---
 clang/test/SemaHLSL/Texture2D-mips-errors.hlsl | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/clang/test/SemaHLSL/Texture2D-mips-errors.hlsl 
b/clang/test/SemaHLSL/Texture2D-mips-errors.hlsl
index 0c0fc074cae0b..44f7240e59c21 100644
--- a/clang/test/SemaHLSL/Texture2D-mips-errors.hlsl
+++ b/clang/test/SemaHLSL/Texture2D-mips-errors.hlsl
@@ -4,7 +4,8 @@ Texture2D<float4> t;
 
 template<class T>
 float4 foo(T t) {
-  return t[int2(0, 0)];
+  int2 c = {0,0};
+  return t[c];
 }
 
 [shader("pixel")]
@@ -26,10 +27,7 @@ float4 test_mips() : SV_Target {
   // expected-note@*:* {{implicitly declared protected here}}
   auto c = t.mips;
 
-  // Note: t.mips[0] correctly returns a mips_slice_type prvalue.
-  // Passing it to a template function like 'foo(t.mips[0])' currently crashes 
-  // the compiler due to an unrelated bug in HLSL template instantiation.
-  // See: https://github.com/llvm/llvm-project/issues/188556
-  // return t.mips[0][int2(0, 0)] + foo(t.mips[0]);
-  return t.mips[0][int2(0, 0)];
+  // expected-error@+2 {{calling a protected constructor of class 
'hlsl::Texture2D<>::mips_slice_type'}}
+  // expected-note@*:* {{implicitly declared protected here}}
+  return t.mips[0][int2(0, 0)] + foo(t.mips[0]);
 }

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to