diff --git a/lib/IRGen/GenCall.cpp b/lib/IRGen/GenCall.cpp index 53ca2153872a7..e240a7929b27b 100644 --- a/lib/IRGen/GenCall.cpp +++ b/lib/IRGen/GenCall.cpp @@ -4564,7 +4564,7 @@ void CallEmission::emitToUnmappedExplosionWithDirectTypedError( } // If the regular result type is void, there is nothing to explode - if (!resultType.isVoid()) { + if (!nativeSchema.empty()) { Explosion resultExplosion; if (auto *structTy = dyn_cast(nativeSchema.getExpandedType(IGF.IGM))) { diff --git a/test/IRGen/typed_throws.swift b/test/IRGen/typed_throws.swift index dff2c604c77f7..2951cf5a015c7 100644 --- a/test/IRGen/typed_throws.swift +++ b/test/IRGen/typed_throws.swift @@ -252,3 +252,16 @@ public func reabstractAsyncVoidThrowsNever() async { struct LoadableGeneric: Error {} func throwsLoadableGeneric(_: E) throws(LoadableGeneric) {} + +@inline(never) +func throwError() throws(SmallError) -> Never { + throw SmallError(x: 1) +} + +func conditionallyCallsThrowError(b: Bool) throws(SmallError) -> Int { + if b { + try throwError() + } else { + return 0 + } +}