<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132945>132945</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
std::expected link error
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
andrea-cassioli-maersk
</td>
</tr>
</table>
<pre>
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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8Vk2P2zgM_TXKhYghS4kTH3zwJBN0L93DtueBLNOxtvowJDkf_34hO2mKmXY7O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