Debian Codegraph @

gcc/testsuite/g++.dg/concepts/fn5.C

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