Open
Description
Description
IRGen seems to ignore the noexcept specifier on a C++ function.
Reproduction
$ cat test.h
void (* _Nonnull getFunctionPtr() noexcept)() noexcept;
$ cat test.swift
func test() {
getFunctionPtr()()
}
$ swift-frontend test.swift -cxx-interoperability-mode=default -emit-irgen
define hidden swiftcc void @"$s4testAAyyF"() #1 personality ptr @__gxx_personality_v0 {
entry:
%0 = call ptr @_Z14getFunctionPtrv()
invoke void %0()
to label %invoke.cont unwind label %exception.unwind
invoke.cont: ; preds = %entry
ret void
exception.unwind: ; preds = %entry
%1 = landingpad { ptr, i32 }
catch ptr null
call void @llvm.trap()
unreachable
}
Expected behavior
The invoke
instruction should be just a call
as the function pointer type is annotated with noexcept
.
Environment
Swift version 6.0-dev (LLVM caa3e1810260259, Swift 1306f522b19a58c)
Target: arm64-apple-macosx14.0
Additional information
No response