[clang] [HLSL] Add bounds checks for the hlsl vector arguments and return types (PR #130724)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 11 09:31:12 PDT 2025


================
@@ -45,6 +45,10 @@ template <typename T> struct is_arithmetic {
   static const bool Value = __is_arithmetic(T);
 };
 
+template <typename T, int N>
+using HLSL_FIXED_VECTOR =
+    vector<__detail::enable_if_t<(N > 1 && N <= 4), T>, N>;
----------------
farzonl wrote:

i tried that, but if you do `__detail::enable_if_t<(N > 1 && N <= 4),vector<T,N>>;` the N template argument gets disambiguated.  `note: candidate template ignored: couldn't infer template argument 'N'` https://godbolt.org/z/8a1sKWrcW

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


More information about the cfe-commits mailing list