[clang] [HLSL] Implement Texture2D::mips[][] (PR #186143)

Nathan Gauër via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 07:08:15 PDT 2026


================
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -emit-llvm -disable-llvm-passes -finclude-default-header -verify %s
+
+Texture2D<float4> t;
+
+void main() {
+  // expected-error at +3 {{'mips_type' is a private member of 'hlsl::Texture2D<>'}}
+  // expected-note@*:* {{implicitly declared private here}}
+  // expected-error at +1 {{intermediate helper type 'Texture2D<float4>::mips_type' cannot be used as a variable}}
+  Texture2D<float4>::mips_type a; 
+
+  // expected-error at +3 {{'mips_slice_type' is a private member of 'hlsl::Texture2D<>'}}
+  // expected-note@*:* {{implicitly declared private here}}
+  // expected-error at +1 {{intermediate helper type 'Texture2D<float4>::mips_slice_type' cannot be used as a variable}}
----------------
Keenuts wrote:

Could you add a test with a template? Then we have a template param, your new error is the only one preventing the user from instantiating a `mips_slice_type` local variable.

https://github.com/llvm/llvm-project/pull/186143


More information about the cfe-commits mailing list