-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++Feature: Interoperability with C++
Description
Describe the bug
When embedding an std::vector in the type from C++, binaries and test targets do not link correctly when linking against the Swift module that depends on the C++ target.
Simple code:
from header
#include <vector>
struct Color {
simd_float4 repr;
};
using ColorArray = std::vector<Color>;
class Life {
public:
__attribute__((swift_name("life")))
int my_life = 0;
ColorArray colors = ColorArray();
Life();
~Life();
};
To Reproduce
Steps to reproduce the behavior:
- Clone repo https://github.com/darknoon/swiftcxxtest at the relevant hash
- Build
...
Expected behavior
Compiles without errors
Screenshots
If applicable, add screenshots to help explain your problem.
Undefined symbols for architecture arm64:
"std::__1::vector<Color, std::__1::allocator<Color> >::vector(std::__1::vector<Color, std::__1::allocator<Color> > const&)", referenced from:
initializeWithCopy value witness for __C.std.__1.__CxxTemplateInstNSt3__16vectorI5ColorNS_9allocatorIS1_EEEE in MyLib.o
Life::Life(Life const&) in MyLib.o
"std::__1::__libcpp_deallocate(void*, unsigned long, unsigned long)", referenced from:
std::__1::allocator<Color>::deallocate(Color*, unsigned long) in MyLib.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Environment (please complete the following information):
- macOS 12.3.1 (21E258)
- Xcode Version 13.3 (13E113)
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++Feature: Interoperability with C++
