[clang] [HLSL][Matrix] Add support for Matrix element and trunc Casts (PR #168915)

Sarah Spall via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 10:02:23 PST 2025


================
@@ -12591,6 +12592,19 @@ void Sema::CheckImplicitConversion(Expr *E, QualType T, SourceLocation CC,
   if (auto VecTy = dyn_cast<VectorType>(Target))
     Target = VecTy->getElementType().getTypePtr();
 
+  if (isa<ConstantMatrixType>(Source)) {
+    if (!isa<ConstantMatrixType>(Target)) {
+      return DiagnoseImpCast(*this, E, T, CC, diag::warn_impcast_matrix_scalar);
+    } else if (getLangOpts().HLSL &&
----------------
spall wrote:

if @llvm-beanz  suggested change is made would this warn when the target is a record type or an array etc?

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


More information about the cfe-commits mailing list