131
|
1 // { dg-do compile { target c++17 } }
|
|
2 // { dg-options "-fconcepts" }
|
111
|
3
|
|
4 // Check shorthand notation.
|
|
5
|
|
6 template<typename T>
|
|
7 concept bool Type() { return true; }
|
|
8
|
|
9 template<typename T, typename U>
|
|
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
|
|
15 void f(Same<int> q) { }
|
|
16 void g(Type a, Same<decltype(a)> 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 "cannot" }
|
|
23 g(0, 'a'); // { dg-error "cannot" }
|
|
24 }
|