aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts-partial-spec4.C
blob: fb3272632c70bba4bb9454b3cc207fad4f032c7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// { dg-do compile { target c++20 } }

template <class T> concept is_int = __is_same_as(T,int);

template <class T> struct A { };
template <is_int T> struct A<T*> {
  typedef int I1;
  static const A<T*>::I1 j1 = 0;
  static int f();
};
template <is_int T> int A<T*>::f()
{ A<T*>::I1 i; return j1; }

template <class T> struct A<T*> {
  typedef int I2;
  static const A<T*>::I2 j2 = 0;
  static int f();
};
template <class T> int A<T*>::f()
{ A<T*>::I2 i; return j2; }

const int i1 = A<int*>::j1;
const int i2 = A<float*>::j2;

template <class T> struct B;

template <is_int T> struct B<T> {
  typedef int I4;
  static const B<T>::I4 j4 = 0;
  static int f();
};
template <is_int T> int B<T>::f()
{ B<T>::I4 i; return j4; }

template <class T> struct B {
  typedef int I5;
  static const B<T>::I5 j5 = 0;
  static int f();
};
template <class T> int B<T>::f()
{ B<T>::I5 i; return j5; }

int i4 = B<int>::j4;
int i5 = B<float>::j5;
int main()
{
  B<int>::f();
  B<float>::f();
}