defs.h
3.79 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
struct A { int a_member; };
inline int use_a(A a) { return a.a_member; }
class B {
struct Inner1 {};
public:
struct Inner2;
struct Inner3;
template<typename T> void f();
};
struct BFriend {
friend class B::Inner3;
private:
struct Inner3Base {};
};
// Check that lookup and access checks are performed in the right context.
struct B::Inner2 : Inner1 {};
struct B::Inner3 : BFriend::Inner3Base {};
template<typename T> void B::f() {}
template<> inline void B::f<int>() {}
// Check that base-specifiers are correctly disambiguated.
template<int N> struct C_Base { struct D { constexpr operator int() const { return 0; } }; };
const int C_Const = 0;
struct C1 : C_Base<C_Base<0>::D{}> {} extern c1;
struct C2 : C_Base<C_Const<0>::D{} extern c2;
typedef struct { int a; void f(); struct X; } D;
struct D::X { int dx; } extern dx;
inline int use_dx(D::X dx) { return dx.dx; }
template<typename T> int E(T t) { return t; }
template<typename T> struct F {
int f();
template<typename U> int g();
static int n;
};
template<typename T> int F<T>::f() { return 0; }
template<typename T> template<typename U> int F<T>::g() { return 0; }
template<typename T> int F<T>::n = 0;
template<> inline int F<char>::f() { return 0; }
template<> template<typename U> int F<char>::g() { return 0; }
template<> struct F<void> { int h(); };
inline int F<void>::h() { return 0; }
template<typename T> struct F<T *> { int i(); };
template<typename T> int F<T*>::i() { return 0; }
namespace G {
enum A { a, b, c, d, e };
enum { f, g, h };
typedef enum { i, j } k;
typedef enum {} l;
}
template<typename T = int, int N = 3, template<typename> class K = F> int H(int a = 1);
template<typename T = int, int N = 3, template<typename> class K = F> using I = decltype(H<T, N, K>());
template<typename T = int, int N = 3, template<typename> class K = F> struct J {};
namespace NS {
struct A {};
template<typename T> struct B : A {};
template<typename T> struct B<T*> : B<char> {};
template<> struct B<int> : B<int*> {};
inline void f() {}
}
namespace StaticInline {
struct X {};
static inline void f(X);
static inline void g(X x) { f(x); }
}
namespace FriendDefArg {
template<typename = int> struct A;
template<int = 0> struct B;
template<template<typename> class = A> struct C;
template<typename = int, int = 0, template<typename> class = A> struct D {};
template<typename U> struct Y {
template<typename> friend struct A;
template<int> friend struct B;
template<template<typename> class> friend struct C;
template<typename, int, template<typename> class> friend struct D;
};
}
namespace SeparateInline {
inline void f();
void f() {}
constexpr int g() { return 0; }
}
namespace TrailingAttributes {
template<typename T> struct X {} __attribute__((aligned(8)));
}
namespace MergeFunctionTemplateSpecializations {
template<typename T> T f();
template<typename T> struct X {
template<typename U> using Q = decltype(f<T>() + U());
};
using xiq = X<int>::Q<int>;
}
enum ScopedEnum : int;
enum ScopedEnum : int { a, b, c };
namespace RedeclDifferentDeclKind {
struct X {};
typedef X X;
using RedeclDifferentDeclKind::X;
}
namespace Anon {
struct X {
union {
int n;
};
};
}
namespace ClassTemplatePartialSpec {
template<typename T> struct F;
template<template<int> class A, int B> struct F<A<B>> {
template<typename C> F();
};
template<template<int> class A, int B> template<typename C> F<A<B>>::F() {}
template<typename A, int B> struct F<A[B]> {
template<typename C> F();
};
template<typename A, int B> template<typename C> F<A[B]>::F() {}
}
struct MemberClassTemplate {
template<typename T> struct A;
};
template<typename T> struct MemberClassTemplate::A {};
template<typename T> struct MemberClassTemplate::A<T*> {};
template<> struct MemberClassTemplate::A<int> {};