<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61387>61387</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Lambda with explicit template parameter and requires clause that uses a dependent variable template is incorrectly rejected
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
brycelelbach
</td>
</tr>
</table>
<pre>
Top of trunk clang rejects the following code:
```
template <typename T> concept C = true;
template <typename T> constexpr bool I = true;
template <typename T> requires(C<T>) auto a(T&& t) { };
template <typename T> requires(I<T>) auto b(T&& t) { };
auto c = [] <typename T> requires(C<T>) (T&& t) { };
auto d = [] <typename T> requires(I<T>) (T&& t) { };
```
complaining that:
```
<source>:8:42: error: 'T' does not refer to a value
auto d = [] <typename T> requires(I<T>) (T&& t) { };
^
<source>:8:23: note: declared here
auto d = [] <typename T> requires(I<T>) (T&& t) { };
^
<source>:8:46: error: use of undeclared identifier 't'
auto d = [] <typename T> requires(I<T>) (T&& t) { };
^
2 errors generated.
Compiler returned: 1
```
If a concept is used instead of an variable template, the code compiles fine. A function definition of similar construction (explicit template parameter and a use of a dependent variable template in the requires clause) is also fine.
GCC and MSVC both accept this code.
[Godbolt reproducer](https://godbolt.org/z/1nE4d4TaP).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VU1v4zYQ_TXjy2ANmbS-Djo4crwI0AIFavROkSOLLUWqJJVs-usLSkm6m0Vj97A1DFmWyDfvveHMiBD0xRI1kN9BftyIOQ7ON51_lmTIdEIOm86p5-bsJnQ9Rj_bP1AaYS_o6XeSMWAcCHtnjHvS9oLSKQJ-gOwI2eu1yF6-y99I42REJATexueJrBgJz8DvUToraYrYIvBjikXA727YFCJ9mTx2zhl8-H7vNQRPf87aUwBWtcDb9AxYjWKODgWw6gysAFZgTE-hvEMojzcQ-wr24T1sdw12vS5r5aJo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