// { dg-do compile { target c++20 } } // { dg-additional-options "-fconcepts-ts" } template concept bool C1 = true; template class X> concept bool C2 = true; template concept bool C3 = true; C1{A, B, ...C} struct S1 { }; C2{T} void f(); C2{...Ts} void g(); // { dg-error "cannot be introduced" } C3{...Ts} struct S2 { }; C3{T, U, V} struct S3 { }; C3{...Ts, U} struct S4 { }; // { dg-error "cannot deduce template parameters" } template struct X { }; void driver1() { S1 s1a; S1<0, 0, char, bool, float> s1b; // { dg-error "type/value mismatch" } f(); f(); // { dg-error "no matching function for call" } // { dg-error "type/value mismatch at argument 1" "" { target *-*-* } .-1 } // { dg-message "expected a class template, got .int." "" { target *-*-* } .-2 } S2 s2a; S2 s2b; S2<0> s2c; // { dg-error "type/value mismatch" } S3 s3a; S3 s3b; // { dg-error "wrong number of template arguments" } } template struct all_same; template struct all_same { static constexpr bool value = __is_same_as(T, U) && all_same::value; }; template struct all_same { static constexpr bool value = true; }; template<> struct all_same<> { static constexpr bool value = true; }; template concept AllSame = all_same::value; AllSame{...Ts} struct S5 { }; AllSame{T, U} struct S6 { }; void driver2() { S5 s5a; S5 s5b; S5 s5c; // { dg-error "template constraint failure" } S6 s6a; S6 s6c; // { dg-error "template constraint failure" } S6 s6b; // { dg-error "wrong number of template arguments" } }