Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/concepts/partial-concept-id1.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 // { dg-do compile { target c++17 } } | 1 // { dg-do compile { target c++17_only } } |
2 // { dg-options "-fconcepts" } | 2 // { dg-options "-fconcepts" } |
3 | 3 |
4 template<typename T> | 4 template<typename T> |
5 concept bool Type() { return true; } | 5 concept bool Type = true; |
6 | 6 |
7 template<typename T, typename U> | 7 template<typename T, typename U> |
8 concept bool Same() { return __is_same_as(T, U); } | 8 concept bool Same = __is_same_as(T, U); |
9 | 9 |
10 template<typename T, typename U> | 10 template<typename T, typename U> |
11 concept bool C1() { return true; } | 11 concept bool C1 = true; |
12 | 12 |
13 template<typename T, typename... Args> | 13 template<typename T, typename... Args> |
14 concept bool C2() { return true; } | 14 concept bool C2 = true; |
15 | |
16 template<typename T, typename U> | |
17 concept bool C3 = __is_same_as(T, int) && __is_same_as(U, double); | |
15 | 18 |
16 template<Same<int> T> struct S1 { }; | 19 template<Same<int> T> struct S1 { }; |
17 template<typename T, Same<T> U> struct S2 { }; | 20 template<typename T, Same<T> U> struct S2 { }; |
18 | 21 |
19 void f(Same<int> q) { } | 22 template<Same<int> Q> |
20 void g(Type a, Same<decltype(a)> b) { } | 23 void f(Q q) { } |
24 template<Type A, Same<decltype(A{})> B> | |
25 void g(A a, B b) { } | |
21 | 26 |
22 void h0(Same<int>* a) { } | 27 template<Same<int> A> |
23 void h1(C1<int>* a) { } | 28 void h0(A* a) { } |
24 void h2(C2<char, short, int, long>* a) { } | 29 template<C1<int> A> |
30 void h1(A* a) { } | |
31 template<C2<char, short, int, long> A> | |
32 void h2(A* a) { } | |
33 template<C3<double> A> | |
34 void h3(A* a) { } | |
25 | 35 |
26 int main() { | 36 int main() { |
27 S1<int> s1; | 37 S1<int> s1; |
28 S2<int, int> s2; | 38 S2<int, int> s2; |
29 f(0); | 39 f(0); |
30 g(0, 1); | 40 g(0, 1); |
31 h0((int*)0); | 41 h0((int*)0); |
32 h1((int*)0); | 42 h1((int*)0); |
33 h2((int*)0); | 43 // h2((int*)0); |
44 h3((int*)0); | |
34 } | 45 } |