diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp index 6240539377a7b0..9f417018284c43 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp @@ -260,11 +260,6 @@ mlir::Type CIRGenTypes::ConvertFunctionTypeInternal(QualType QFT) { // the function type. assert(isFuncTypeConvertible(FT) && "NYI"); - // While we're converting the parameter types for a function, we don't want to - // recursively convert any pointed-to structs. Converting directly-used - // structs is ok though. - assert(RecordsBeingLaidOut.insert(Ty).second && "NYI"); - // The function type can be built; call the appropriate routines to build it const CIRGenFunctionInfo *FI; if (const auto *FPT = dyn_cast(FT)) { diff --git a/clang/test/CIR/CodeGen/fun-ptr.c b/clang/test/CIR/CodeGen/fun-ptr.c index bda1a2fc233ebc..ae4f1ac8d3d6de 100644 --- a/clang/test/CIR/CodeGen/fun-ptr.c +++ b/clang/test/CIR/CodeGen/fun-ptr.c @@ -11,6 +11,16 @@ typedef struct { typedef int (*fun_t)(Data* d); +struct A; +typedef int (*fun_typ)(struct A*); + +typedef struct A { + fun_typ fun; +} A; + +// CIR: !ty_22A22 = !cir.struct (!cir.ptr>)>>} #cir.record.decl.ast> +A a = {(fun_typ)0}; + int extract_a(Data* d) { return d->a; }