Interop: Cannot return swift::Optional<swift::String>
from C++ function
#76024
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
c++ interop
Feature: Interoperability with C++
clang importer
Area → compiler: The clang importer
Description
Is it intended that the bound types
swift::Optional
andswift::String
cannot be used to return swift types to swift?Attempting to do so results in the
swift::Optional<T>
for some T being replaced withNever
Reproduction
This test case requires a few files, which I have uploaded here:
https://github.com/ADKaster/swift-return-swift-type
The results can be reproduced with
cmake -B build -GNinja cmake --build build # or ninja -C build
In the example, a few things are happening:
swift::Optional<T>
for some T.Helper.h
Helper.cpp
Helper.swift
Expected behavior
The program should compile successfully and print "42\nnone\n"
Environment
swift-driver version: 1.113 Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1)
Target: arm64-apple-macosx14.0
Additional information
No response
The text was updated successfully, but these errors were encountered: