diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -10479,7 +10479,6 @@ return false; Field1Ty = CGT.ConvertType(EltTy); Field1Off = CurOff; - assert(CurOff.isZero() && "Unexpected offset for first field"); Field2Ty = Field1Ty; Field2Off = Field1Off + getContext().getTypeSizeInChars(EltTy); return true; diff --git a/clang/test/CodeGen/riscv32-ilp32d-abi.cpp b/clang/test/CodeGen/riscv32-ilp32d-abi.cpp --- a/clang/test/CodeGen/riscv32-ilp32d-abi.cpp +++ b/clang/test/CodeGen/riscv32-ilp32d-abi.cpp @@ -32,3 +32,11 @@ double f_empty_double_float(empty_double_float a) { return a.g; } + +struct empty_complex { struct {}; double _Complex fc; }; + +// CHECK: define double @_Z15f_empty_complex13empty_complex(double %0, double %1) +// CHECK: { [8 x i8], double, double } +double f_empty_complex(empty_complex a) { + return __imag__ a.fc; +}