|
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 | // Undefined hidden symbol to C++ voidify in libcxx
|
9 | 11 | // rdar://121551667
|
@@ -62,10 +64,18 @@ StdOptionalTestSuite.test("std::optional init(_:Wrapped)") {
|
62 | 64 |
|
63 | 65 | // FIXME: making these variables immutable triggers a miscompile on Linux
|
64 | 66 | // (https://github.com/swiftlang/swift/issues/82765)
|
65 |
| - var optBoolT = StdOptionalBool(true) |
66 |
| - var optBoolF = StdOptionalBool(false) |
| 67 | + var optBoolTMutable = StdOptionalBool(true) |
| 68 | + var optBoolFMutable = StdOptionalBool(false) |
| 69 | + expectTrue(optBoolTMutable.pointee) |
| 70 | + expectFalse(optBoolFMutable.pointee) |
| 71 | + |
| 72 | + // If AddressableParameters are enabled, this issue does not happen. |
| 73 | +#if hasFeature(AddressableParameters) |
| 74 | + let optBoolT = StdOptionalBool(true) |
| 75 | + let optBoolF = StdOptionalBool(false) |
67 | 76 | expectTrue(optBoolT.pointee)
|
68 | 77 | expectFalse(optBoolF.pointee)
|
| 78 | +#endif |
69 | 79 |
|
70 | 80 | let optString = StdOptionalString(std.string("abc"))
|
71 | 81 | expectEqual(std.string("abc"), optString.pointee)
|
|
0 commit comments