Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 1 | struct A { int a_member; }; |
Richard Smith | 9a71c99 | 2015-03-27 20:16:58 +0000 | [diff] [blame] | 2 | inline int use_a(A a) { return a.a_member; } |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 3 | |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 4 | class B { |
| 5 | struct Inner1 {}; |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 6 | public: |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 7 | struct Inner2; |
Richard Smith | d6aab59 | 2015-03-27 21:57:41 +0000 | [diff] [blame] | 8 | template<typename T> void f(); |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 9 | }; |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 10 | // Check that lookup and access checks are performed in the right context. |
Richard Smith | 65ebb4a | 2015-03-26 04:09:53 +0000 | [diff] [blame] | 11 | struct B::Inner2 : Inner1 {}; |
Richard Smith | d6aab59 | 2015-03-27 21:57:41 +0000 | [diff] [blame] | 12 | template<typename T> void B::f() {} |
Richard Smith | be3980b | 2015-03-27 00:41:57 +0000 | [diff] [blame] | 13 | |
| 14 | // Check that base-specifiers are correctly disambiguated. |
| 15 | template<int N> struct C_Base { struct D { constexpr operator int() const { return 0; } }; }; |
| 16 | const int C_Const = 0; |
| 17 | struct C1 : C_Base<C_Base<0>::D{}> {} extern c1; |
| 18 | struct C2 : C_Base<C_Const<0>::D{} extern c2; |
Richard Smith | a523022 | 2015-03-27 01:37:43 +0000 | [diff] [blame] | 19 | |
| 20 | typedef struct { int a; void f(); struct X; } D; |
| 21 | struct D::X { int dx; } extern dx; |
Richard Smith | 9a71c99 | 2015-03-27 20:16:58 +0000 | [diff] [blame] | 22 | inline int use_dx(D::X dx) { return dx.dx; } |
Richard Smith | d6aab59 | 2015-03-27 21:57:41 +0000 | [diff] [blame] | 23 | |
| 24 | template<typename T> int E(T t) { return t; } |
| 25 | |
| 26 | template<typename T> struct F { |
| 27 | int f(); |
| 28 | template<typename U> int g(); |
Richard Smith | 82e57fb | 2015-05-19 00:49:29 +0000 | [diff] [blame] | 29 | static int n; |
Richard Smith | d6aab59 | 2015-03-27 21:57:41 +0000 | [diff] [blame] | 30 | }; |
| 31 | template<typename T> int F<T>::f() { return 0; } |
| 32 | template<typename T> template<typename U> int F<T>::g() { return 0; } |
Richard Smith | 82e57fb | 2015-05-19 00:49:29 +0000 | [diff] [blame] | 33 | template<typename T> int F<T>::n = 0; |
Richard Smith | c7e6ff0 | 2015-05-18 20:36:47 +0000 | [diff] [blame] | 34 | template<> template<typename U> int F<char>::g() { return 0; } |
| 35 | template<> struct F<void> { int h(); }; |
| 36 | inline int F<void>::h() { return 0; } |
| 37 | template<typename T> struct F<T *> { int i(); }; |
| 38 | template<typename T> int F<T*>::i() { return 0; } |
Richard Smith | d9ba224 | 2015-05-07 03:54:19 +0000 | [diff] [blame] | 39 | |
| 40 | namespace G { |
| 41 | enum A { a, b, c, d, e }; |
| 42 | enum { f, g, h }; |
| 43 | typedef enum { i, j } k; |
| 44 | typedef enum {} l; |
| 45 | } |
Richard Smith | c7d48d1 | 2015-05-20 17:50:35 +0000 | [diff] [blame] | 46 | |
Richard Smith | fd8b64e | 2015-05-20 18:24:21 +0000 | [diff] [blame] | 47 | template<typename T = int, int N = 3, template<typename> class K = F> int H(int a = 1); |
| 48 | template<typename T = int, int N = 3, template<typename> class K = F> using I = decltype(H<T, N, K>()); |
Richard Smith | c785276 | 2015-06-11 23:46:11 +0000 | [diff] [blame^] | 49 | template<typename T = int, int N = 3, template<typename> class K = F> struct J {}; |
Richard Smith | 00be6d0 | 2015-06-11 03:05:39 +0000 | [diff] [blame] | 50 | |
| 51 | namespace NS { |
| 52 | struct A {}; |
Richard Smith | 0f192e8 | 2015-06-11 22:48:25 +0000 | [diff] [blame] | 53 | template<typename T> struct B : A {}; |
| 54 | template<typename T> struct B<T*> : B<char> {}; |
| 55 | template<> struct B<int> : B<int*> {}; |
Richard Smith | 00be6d0 | 2015-06-11 03:05:39 +0000 | [diff] [blame] | 56 | inline void f() {} |
| 57 | } |