131
|
1 // { dg-do compile { target c++17 } }
|
|
2 // { dg-options "-fconcepts" }
|
111
|
3
|
|
4 template<typename T>
|
|
5 concept bool C() { return __is_class(T); }
|
|
6
|
|
7 template<int N>
|
|
8 concept bool Int() { return true; }
|
|
9
|
|
10 template<template<typename> class X>
|
|
11 concept bool Template() { return true; }
|
|
12
|
|
13 struct S { };
|
|
14
|
|
15 void f1(Int) { } // { dg-error "" }
|
|
16 void f2(Template) { } // { dg-error "" }
|
|
17
|
|
18 struct S1 {
|
|
19 void f1(auto x) { }
|
|
20 void f2(C x) { }
|
|
21
|
|
22 void f3(auto x) { }
|
|
23 void f3(C x) { }
|
|
24 };
|
|
25
|
|
26 template<C T>
|
|
27 struct S2 {
|
|
28 void f1(auto x) { }
|
|
29 void f2(C x) { }
|
|
30
|
|
31 void h1(auto x);
|
|
32 void h2(C x);
|
|
33
|
|
34 template<C U>
|
|
35 void g(T t, U u) { }
|
|
36 };
|
|
37
|
|
38 int main() {
|
|
39 S s;
|
|
40
|
|
41 S1 s1;
|
|
42 s1.f2(0); // { dg-error "matching" }
|
|
43
|
|
44 S2<S> s2;
|
|
45 s2.f2(0); // { dg-error "matching" }
|
|
46 s2.h2(0); // { dg-error "matching" }
|
|
47
|
|
48 s2.g(s, 0); // { dg-error "matching" }
|
|
49 s2.g(0, s); // { dg-error "matching" }
|
|
50 }
|