mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Clang is using C++17 standard version by default since Clang 16. Swift’s ClangImporter should do the same, to make sure that clients who run clang and then swiftc without explicit std version see consistent behavior. rdar://125777068
34 lines
1.1 KiB
Swift
34 lines
1.1 KiB
Swift
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop)
|
|
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=swift-6)
|
|
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift)
|
|
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift -Xcc -std=c++14)
|
|
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift -Xcc -std=c++17)
|
|
// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift -Xcc -std=c++20)
|
|
|
|
// REQUIRES: executable_test
|
|
|
|
import StdlibUnittest
|
|
import StdFunction
|
|
|
|
var StdFunctionTestSuite = TestSuite("StdFunction")
|
|
|
|
StdFunctionTestSuite.test("init empty") {
|
|
let f = FunctionIntToInt()
|
|
expectTrue(isEmptyFunction(f))
|
|
|
|
let copied = f
|
|
expectTrue(isEmptyFunction(copied))
|
|
}
|
|
|
|
StdFunctionTestSuite.test("call") {
|
|
let f = getIdentityFunction()
|
|
expectEqual(123, f(123))
|
|
}
|
|
|
|
StdFunctionTestSuite.test("retrieve and pass back as parameter") {
|
|
let res = invokeFunction(getIdentityFunction(), 456)
|
|
expectEqual(456, res)
|
|
}
|
|
|
|
runAllTests()
|