File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ module StdAny {
2+ header "std-any.h"
3+ requires cplusplus
4+ export *
5+ }
6+
17module StdNumeric {
28 header "std-numeric.h"
39 requires cplusplus
Original file line number Diff line number Diff line change 1+ #include < any>
2+ #include < string>
3+
4+ inline std::any getStdAnyString () {
5+ return std::string (" abc210" );
6+ }
Original file line number Diff line number Diff line change 1+ // RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift)
2+ // RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift -Xcc -std=c++17)
3+ // RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift -Xcc -std=c++20)
4+
5+ // REQUIRES: executable_test
6+
7+ // In Microsoft STL, all overloads of std::any_cast return a dependent templated
8+ // type, which Swift isn't able to instantiate.
9+ // UNSUPPORTED: OS=windows-msvc
10+
11+ import StdlibUnittest
12+ import StdAny
13+ import CxxStdlib
14+
15+ var StdAnyTestSuite = TestSuite ( " StdAny " )
16+
17+ StdAnyTestSuite . test ( " std.any_cast<std.string> " ) {
18+ let a1 = getStdAnyString ( )
19+ let c1 = std. any_cast ( a1) as std . string
20+ expectEqual ( c1, std. string ( " abc210 " ) )
21+ }
22+
23+ runAllTests ( )
You can’t perform that action at this time.
0 commit comments