comparison gcc/testsuite/g++.dg/concepts/generic-fn-err.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 // { dg-options "-std=c++17 -fconcepts" }
2
3 template<typename T>
4 concept bool C() { return __is_class(T); }
5
6 template<int N>
7 concept bool Int() { return true; }
8
9 template<template<typename> class X>
10 concept bool Template() { return true; }
11
12 struct S { };
13
14 void f1(Int) { } // { dg-error "" }
15 void f2(Template) { } // { dg-error "" }
16
17 struct S1 {
18 void f1(auto x) { }
19 void f2(C x) { }
20
21 void f3(auto x) { }
22 void f3(C x) { }
23 };
24
25 template<C T>
26 struct S2 {
27 void f1(auto x) { }
28 void f2(C x) { }
29
30 void h1(auto x);
31 void h2(C x);
32
33 template<C U>
34 void g(T t, U u) { }
35 };
36
37 int main() {
38 S s;
39
40 S1 s1;
41 s1.f2(0); // { dg-error "matching" }
42
43 S2<S> s2;
44 s2.f2(0); // { dg-error "matching" }
45 s2.h2(0); // { dg-error "matching" }
46
47 s2.g(s, 0); // { dg-error "matching" }
48 s2.g(0, s); // { dg-error "matching" }
49 }