Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/concepts-ctad4.C

raw
1 // PR c++/100138
2 // { dg-do compile { target c++20 } }
3
4 template <class T>
5 struct A {
6 A(T, auto... xs) requires (sizeof...(xs) != 0);
7 };
8
9 constexpr bool f(...) { return true; }
10
11 template <class T>
12 struct B {
13 B(T, auto... xs) requires (f(xs...)); // { dg-error "constant expression" }
14 };
15
16 template <class T>
17 struct C {
18 C(T, auto x) requires (f(x)); // { dg-error "constant expression" }
19 };
20
21 int main() {
22 A x{1, 2}; // { dg-bogus "" }
23 B y{1, 2}; // { dg-error "deduction|no match" }
24 C z{1, 2}; // { dg-error "deduction|no match" }
25 }