[clang] [CIR] Add support for array constructors (PR #149142)

Morris Hafner via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 23 08:34:12 PDT 2025


================
@@ -0,0 +1,93 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir -mmlir --mlir-print-ir-before=cir-lowering-prepare %s -o -  2>&1 | FileCheck --check-prefixes=CIR-BEFORE-LPP %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
+
+struct S {
+    S();
+};
+
+void foo() {
+    S s[42];
+}
+
----------------
mmha wrote:

I tried. Good catch, it doesn't work :) The array to pointer decay is incorrect in the incubator CodeGen (and probably in LoweringPrepare, too). I'm looking into getting this fixed in this PR and the incubator.

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


More information about the cfe-commits mailing list