<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95664>95664</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang handles unqualified-ids Incorrectly in lambda-expressions (P2036R3, P2579R0)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ckwastra
</td>
</tr>
</table>
<pre>
Test code ([Godbolt](https://godbolt.org/z/M8jhEYo8s)):
```cpp
// -std=c++23
#include <cstdio>
template <class T> void print() { std::puts(__PRETTY_FUNCTION__); }
int main() {
int x = 42;
auto l0 = [=]() -> decltype((x)) { return (int &)x; };
auto l1 = [=] /* () */ -> decltype((x)) { return x; };
print<decltype(l0())>(); // Clang: int & (expected: const int &)
print<decltype(l1())>(); // Clang: const int & (correct)
[=] {
[=](decltype((x)) y) {
print<decltype(y)>(); // Clang: int & (expected: const int &)
}((int &)x);
print<decltype((x))>(); // Clang: const int & (correct)
}();
}
```
The above code is derived from [Example 1](https://timsong-cpp.github.io/cppwp/n4950/expr.prim.id.unqual#example-1) in [[expr.prim.id.unqual]](https://timsong-cpp.github.io/cppwp/n4950/expr.prim.id.unqual), which was introduced in [P2036R3](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2036r3.html) and [P2579R0](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2579r0.pdf).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU2P4ygU_DXkgmLZDzs2Bx_y5dUcdnY0yh7m1MJAx_RiwxrcSe-vX4GTTnoUrUbalqxuhwdVRZUfMOfUcZCyRsUGFbsFm3xnxpr_dWLOj2zRGvFWH6TzmBshMYIKFZvfjGiN9qjYIag6761DZI2gQdAc51JixiOC5h8Eze_VS7f_YSqHgIaHrFG6Q-n17yqdH27tZSTi4KXzApEdR7BBsAFyLRI1cD0FKWTLnRfKILKf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