|
1 | 1 | // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=swift-5.9) |
2 | 2 | // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=swift-6) |
3 | 3 | // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=upcoming-swift) |
| 4 | +// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=upcoming-swift -enable-experimental-feature AddressableParameters) |
4 | 5 | // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=upcoming-swift -Xcc -std=c++20) |
5 | 6 | // |
6 | 7 | // REQUIRES: executable_test |
| 8 | +// REQUIRES: swift_feature_AddressableParameters |
7 | 9 |
|
8 | 10 | import StdlibUnittest |
9 | 11 | import StdOptional |
@@ -58,10 +60,18 @@ StdOptionalTestSuite.test("std::optional init(_:Wrapped)") { |
58 | 60 |
|
59 | 61 | // FIXME: making these variables immutable triggers a miscompile on Linux |
60 | 62 | // (https://github.com/swiftlang/swift/issues/82765) |
61 | | - var optBoolT = StdOptionalBool(true) |
62 | | - var optBoolF = StdOptionalBool(false) |
| 63 | + var optBoolTMutable = StdOptionalBool(true) |
| 64 | + var optBoolFMutable = StdOptionalBool(false) |
| 65 | + expectTrue(optBoolTMutable.pointee) |
| 66 | + expectFalse(optBoolFMutable.pointee) |
| 67 | + |
| 68 | + // If AddressableParameters are enabled, this issue does not happen. |
| 69 | +#if hasFeature(AddressableParameters) |
| 70 | + let optBoolT = StdOptionalBool(true) |
| 71 | + let optBoolF = StdOptionalBool(false) |
63 | 72 | expectTrue(optBoolT.pointee) |
64 | 73 | expectFalse(optBoolF.pointee) |
| 74 | +#endif |
65 | 75 |
|
66 | 76 | let optString = StdOptionalString(std.string("abc")) |
67 | 77 | expectEqual(std.string("abc"), optString.pointee) |
|
0 commit comments