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(); |
| 29 | }; |
| 30 | template<typename T> int F<T>::f() { return 0; } |
| 31 | template<typename T> template<typename U> int F<T>::g() { return 0; } |
Richard Smith | c7e6ff0 | 2015-05-18 20:36:47 +0000 | [diff] [blame^] | 32 | template<> template<typename U> int F<char>::g() { return 0; } |
| 33 | template<> struct F<void> { int h(); }; |
| 34 | inline int F<void>::h() { return 0; } |
| 35 | template<typename T> struct F<T *> { int i(); }; |
| 36 | template<typename T> int F<T*>::i() { return 0; } |
Richard Smith | d9ba224 | 2015-05-07 03:54:19 +0000 | [diff] [blame] | 37 | |
| 38 | namespace G { |
| 39 | enum A { a, b, c, d, e }; |
| 40 | enum { f, g, h }; |
| 41 | typedef enum { i, j } k; |
| 42 | typedef enum {} l; |
| 43 | } |