<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57396>57396</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
CWG 2611 decltype and fold-expressions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++17
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hubert-reinterpretcast
</td>
</tr>
</table>
<pre>
[CWG 2611](https://cplusplus.github.io/CWG/issues/2611.html) clarifies that the following should compile.
That is, `decltype` should never operate on the expansion of the _fold-expression_ as an unparenthesized _id-expression_ (or class member access).
Original example by @opensdh: https://godbolt.org/z/K46qdhdnb
### Self-contained source (`<stdin>`):
```
template <class> struct Chk;
template <> struct Chk<int &> { static constexpr bool v = true; };
template <class ...TT>
void f(TT ...tt) {
static_assert(Chk<decltype((tt, ...))>::v);
}
template void f(int);
```
### Compiler invocation:
```
clang++ -fsyntax-only -std=c++17 -xc++ -
```
### Actual output:
```
<stdin>:5:17: error: implicit instantiation of undefined template 'Chk<int>'
static_assert(Chk<decltype((tt, ...))>::v);
^
<stdin>:7:15: note: in instantiation of function template specialization 'f<int>' requested here
template void f(int);
^
<stdin>:1:25: note: template is declared here
template <class> struct Chk;
^
1 error generated.
```
### Expected output:
(Clean compile)
### Compiler version info (`clang++ -v`):
```
clang version 16.0.0 (https://github.com/llvm/llvm-project.git 6f88388f61327b375112e76ff4b80741a1b349cb)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVktv4zYQ_jXyhZAgUU8ffEicZFH00EMN9BhQ5Mhilya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