[clang] [Matrix][Clang][HLSL] Move MaxMatrixDimension to a LangOpt (PR #163307)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 15 08:47:20 PDT 2025
================
@@ -10,3 +10,9 @@ uint16_t4x4 mat2;
matrix<int, 5, 5> mat3;
// expected-error at -1 {{constraints not satisfied for alias template 'matrix' [with element = int, rows_count = 5, cols_count = 5]}}
// expected-note@* {{because '5 <= 4' (5 <= 4) evaluated to false}}
+
+using float8x4 = __attribute__((matrix_type(8,4))) float;
+// expected-error at -1 {{matrix row size too large}}
+
+using float4x8 = __attribute__((matrix_type(4,8))) float;
+// expected-error at -1 {{matrix column size too large}}
----------------
farzonl wrote:
The current implementation does not do multiple errors so if both row/col are larger than 4 then we will just error `matrix row size too large`. The negative cases will just be treated as an unsinged integer so 4294967295 and will also be a `row dimensions too large case`. All of these will error.
https://github.com/llvm/llvm-project/pull/163307
More information about the cfe-commits
mailing list