[clang] [HLSL] Make it possible to assign an array from a cbuffer (PR #134174)

Finn Plummer via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 13:26:58 PDT 2025


================
@@ -2268,17 +2268,15 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
     // handling here.
     if (ToType->isArrayParameterType()) {
       FromType = S.Context.getArrayParameterType(FromType);
-      SCS.First = ICK_HLSL_Array_RValue;
     } else if (FromType->isArrayParameterType()) {
       const ArrayParameterType *APT = cast<ArrayParameterType>(FromType);
       FromType = APT->getConstantArrayType(S.Context);
-      SCS.First = ICK_HLSL_Array_RValue;
-    } else {
-      SCS.First = ICK_Identity;
     }
 
-    if (S.Context.getCanonicalType(FromType) !=
-        S.Context.getCanonicalType(ToType))
+    SCS.First = ICK_HLSL_Array_RValue;
+
----------------
inbelic wrote:

```suggestion

    // Compare unqualified types because irrelevant qualifiers can cause assignment
    // to fail. Eg: when casting from a cbuffer value, it will have a unique address space
    // that shouldn't matter for casting
```

Or something or other, just to make the why we are dropped the qualifiers more visible. From https://github.com/llvm/llvm-project/issues/133767#issuecomment-2773224779

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


More information about the cfe-commits mailing list