File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -514,10 +514,11 @@ func _convertConstStringToUTF8PointerArgument<
514514}
515515#else
516516@_transparent
517- @_unavailableInEmbedded
518- public
519- func _convertConstStringToUTF8PointerArgument< ToPointer: _Pointer > (
520- _ str: String ) -> ( Builtin . NativeObject ? , ToPointer ) {
521- fatalError ( " unreachable in embedded Swift (marked as unavailable) " )
517+ public // COMPILER_INTRINSIC
518+ func _convertConstStringToUTF8PointerArgument<
519+ ToPointer: _Pointer
520+ > ( _ str: String ) -> ( Builtin . NativeObject ? , ToPointer ) {
521+ let utf8 = Array ( str. utf8CString)
522+ return _convertConstArrayToPointerArgument ( utf8)
522523}
523524#endif
Original file line number Diff line number Diff line change 1+ // RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -wmo) | %FileCheck %s
2+
3+ // REQUIRES: swift_in_compiler
4+ // REQUIRES: executable_test
5+ // REQUIRES: optimized_stdlib
6+ // REQUIRES: OS=macosx || OS=linux-gnu
7+
8+ @_extern ( c)
9+ func puts( _ string: UnsafePointer < CChar > ? ) -> CInt
10+
11+ func foo( _ string: UnsafePointer < CChar > ? ) {
12+ puts ( string)
13+ }
14+
15+ foo ( " hello " )
16+ // CHECK: hello
You can’t perform that action at this time.
0 commit comments