c++: change -fconcepts to mean C++20 concepts
[official-gcc.git] / gcc / testsuite / g++.dg / concepts / fn5.C
blob3decf4e38ee35ca0c995330f6dec338a2334b467
1 // { dg-do compile { target c++17_only } }
2 // { dg-options "-fconcepts-ts" }
4 // Check shorthand notation.
6 template<typename T>
7   concept bool Type() { return true; }
9 template<typename T, typename U>
10   concept bool Same() { return __is_same_as(T, U); }
12 template<Same<int> T> struct S1 { };
13 template<typename T, Same<T> U> struct S2 { };
15 void f(Same<int> q) { }
16 void g(Type a, Same<decltype(a)> b) { }
18 int main() {
19   S1<char> s1;      // { dg-error "constraint|invalid" }
20   S2<int, char> s2; // { dg-error "constraint|invalid" }
22   f('a');    // { dg-error "no match" }
23   g(0, 'a'); // { dg-error "no match" }