<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/102918>102918</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`decltype(lambda)` has internal linkage
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vogelsgesang
</td>
</tr>
</table>
<pre>
For the code below (also see https://godbolt.org/z/or53Y5c9j for a slightly more realistic example)
```cpp
#include <map>
using my_less = decltype([](int a, int b) { return a < b; });
using my_map = std::map<int, int, my_less>;
my_map foo();
int main() {
std::cerr << foo().size() << std::endl;
}
```
`clang++ -std=c++23 -Werror` reports the error
```
In file included from <source>:1:
/app/util.hpp:6:8: error: function 'foo' has internal linkage but is not defined [-Werror,-Wundefined-internal]
6 | my_map foo();
| ^
<source>:5:18: note: used here
5 | std::cerr << foo().size() << std::endl;
| ^
1 error generated.
Compiler returned: 1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVM2O4zYMfhrmQiSQpdiODz7kpwb6BIueCtlibG1lyZDk2c4-fSHbmUzT6W2FQIrI8NNHfgxlCLq3RDXkF8hvOznHwfn6zfVkQk9B2n7XOvVeN85jHAg7pwhbMu4HAj9JExwGIhxinAKIM_AGeNM71ToTD873wJufwBvnc_FH3lXf8e48SgxG90M07zg6T-hJGh2i7pD-luNkCHgF7AbsvO0FWz_dNG0WLrTtzKwIQVxHOYH47XPEHLTtcXz_01AICOKGijoT3ycCflpzBX7SNqIEfsX0pQVeIZQX9BRnb1EmZGxBXBDKW2IkLi_go5wW7BBVyl2cFyJXbeMGmo6NRCL4AFj3DeDuXOL0CX_dE6dRars6E7PVjojPBzvyPvFMVD-ADkH_pEfY6vsIIKvM86Hy9lLgl6p3Rtoe-AX4BfcLxq1br1zg_ht57zwUDD1NzsewdMhq_Eq99fq7xbs2hJt-Cu_ejYlncLPvaKnTOUtsN6UbOU3AmzlqcximCcS5AHE-gThvb4kz3mfbRe0sAi-XOpQ4yJAkIG-lQaPtX7InbOeIOqB1ERXdtSWFkF8emfDr_ttsN8f-EZx65aPyBUJ5xf-VDpeVfrItyB99-e8E85TkkoN1kdI5B1I4kKcnUr4g_SKx_0PtuT5IZmtFsSdLXkZSh9V-deOkDfntv0EJH7MXeXeqFqoSldxRnZVcHMuSs2w31CRbxoquyIQkoY5FkVedulfsdDyyI6vETtec8SM7ZTzLj4yxg2gr1eYFL6WoqGQZHBmNUpuDMW9jGis7HcJMdcZ4lZ12RrZkwjLDOLf0AxcvcJ5Gmq9T0L6d-wBHluZMeMJEHQ3VULBP48HIsVUyqVqwL7toN3tTv0w8HYe5PXRuBN4k9O3YT959py4CbxZOAXizkX6r-T8BAAD__xKWk1I">