[clang] [HLSL] Desugar ConstantArrayType when calculating cbuffer field layout (PR #134683)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 7 11:53:59 PDT 2025


================
@@ -195,7 +195,8 @@ bool HLSLBufferLayoutBuilder::layoutField(const FieldDecl *FD,
     // Unwrap array to find the element type and get combined array size.
     QualType Ty = FieldTy;
     while (Ty->isConstantArrayType()) {
-      const ConstantArrayType *ArrayTy = cast<ConstantArrayType>(Ty);
+      const ConstantArrayType *ArrayTy =
+          cast<ConstantArrayType>(Ty->getUnqualifiedDesugaredType());
----------------
efriedma-quic wrote:

```suggestion
      auto *ArrayTy = CGM.getContext().getAsConstantArrayType(Ty);
```

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


More information about the cfe-commits mailing list