================
@@ -0,0 +1,71 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -w -fclangir -emit-cir %s
-o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s
+
+// Because LLVM IR uses opaque pointers, nothing in this test would be worth
+// checking there, so LLVM and OGCG checks are omitted.
+
+// Exercise replacing a no-prototype declaration with a prototyped definition
+// when a global struct initializer already took the address of that function.
+// The initializer must use the struct field's function-pointer type (not the
+// FuncOp's no-prototype type) so CIR stays valid after the replacement.
+
+// CHECK: !{{[^ ]+}} = !cir.record<struct "S1" {!cir.ptr<!cir.func<()>>,
!s32i, !s32i}>
+// CHECK: !{{[^ ]+}} = !cir.record<struct "S2" {!cir.ptr<!cir.func<(...)>>,
!s32i, !s32i}>
----------------
andykaylor wrote:
I feel like for any code written in the last 20 years, if someone writes `f()`
they meant for it to be `f(void)`. Of course, not all C code was written in the
last 20 years...
https://github.com/llvm/llvm-project/pull/189741
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits