Issue |
132945
|
Summary |
std::expected link error
|
Labels |
new issue
|
Assignees |
|
Reporter |
andrea-cassioli-maersk
|
Compiling the following example
```
#include <expected>
#include <iostream>
int main() {
std::expected<int, int> a;
auto& x = a.value();
std::cout << x << std::endl;
return 0;
}
```
with
```
/opt/homebrew/opt/llvm@19/bin/clang++ -std=c++23 test-value.cpp
```
I get the following error
```
/opt/homebrew/opt/llvm@19/bin/clang++ -std=c++23 test-value.cpp
Undefined symbols for architecture arm64:
"std::__1::bad_expected_access<void>::what() const", referenced from:
vtable for std::__1::bad_expected_access<int> in test-value-22e761.o
"typeinfo for std::__1::bad_expected_access<void>", referenced from:
typeinfo for std::__1::bad_expected_access<int> in test-value-22e761.o
"vtable for std::__1::bad_expected_access<void>", referenced from:
std::__1::bad_expected_access<void>::bad_expected_access[abi:ne190107]() in test-value-22e761.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```
some more info
```
➜ tmp /opt/homebrew/opt/llvm@19/bin/clang++ -v
Homebrew clang version 19.1.7
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/19.1.7_1/bin
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin23.cfg
System configuration file directory: /opt/homebrew/etc/clang
User configuration file directory: /Users/xxxxxxx/.config/clang
```
Compiling with `clang` version 18 gives no error.
Not sure what is the issue. Hope someone can help.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs