<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60777>60777</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[15->17trunk regression] Parameter packs in requires-clauses in deduction guides are considered non-constant
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Alcaro
</td>
</tr>
</table>
<pre>
```c++
template<typename... Ts>
constexpr bool True() { return true; }
template<typename T>
class A {
public:
template<typename... Ts>
A(T val, Ts... tail)
requires (True<Ts...>())
{}
};
int main() {
A b(42);
}
```
Works on GCC, MSVC, and Clang 15.0.0. But on 17.0.0-26662ac010ef50e65e2774eab84f325aa09360fe, it fails with
```
<source>:9:15: error: substitution into constraint expression resulted in a non-constant expression
requires (True<Ts...>())
^~~~~~~~~~~~~
<source>:14:7: note: while checking constraint satisfaction for template '<deduction guide for A><int>' required here
A b(42);
^
<source>:14:7: note: in instantiation of function template specialization '<deduction guide for A><int>' requested here
<source>:9:15: note: non-literal type '<dependent type>' cannot be used in a constant expression
requires (True<Ts...>())
^
<source>:14:7: error: no viable constructor or deduction guide for deduction of template arguments of 'A'
A b(42);
^
<source>:8:5: note: candidate template ignored: failed template argument deduction
A(T val, Ts... tail)
^
<source>:5:7: note: candidate template ignored: could not match 'A<T>' against 'int'
class A {
^
```
https://godbolt.org/z/sh7TrPGE1
I also found an ICE-on-invalid that I suspect may have the same root cause and/or same solution: https://godbolt.org/z/7qGTddsYh If it doesn't, feel free to ignore it; if this bug is fixed but the ICE remains, I'll file a new bug.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyslktv4zYQgH8NfRnYkCjLsg8-OIq9yKHAAjVa9EiRI4kNTXr5yD4O_e3F0K8km91tgBoGbA2Hw2-elAhBDxZxzeo7Vt9PRIqj8-uNkcK7SefU1zVbFKevZPyOvsU9KzYRD0cjIrKqjV-P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