1 // { dg-do compile { target c++17 } } 2 // { dg-options "-fconcepts" } 3 4 // Check shorthand notation. 5 6 template<typename T> Type()7 concept bool Type() { return true; } 8 9 template<typename T, typename U> Same()10 concept bool Same() { return __is_same_as(T, U); } 11 12 template<Same<int> T> struct S1 { }; 13 template<typename T, Same<T> U> struct S2 { }; 14 f(Same<int> q)15void f(Same<int> q) { } g(Type a,Same<decltype (a)> b)16void g(Type a, Same<decltype(a)> b) { } 17 main()18int main() { 19 S1<char> s1; // { dg-error "constraint|invalid" } 20 S2<int, char> s2; // { dg-error "constraint|invalid" } 21 22 f('a'); // { dg-error "cannot" } 23 g(0, 'a'); // { dg-error "cannot" } 24 } 25