summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/access2.C
blob: c5e3f110395a9237d4a787cf4b4187cc8438e42b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// { dg-do compile }

// PR c++/5387
// Enforcing access of typename type.

template <class T> struct A {
  typename T::X x;			// { dg-error "this context" }
  int f() { return T::i; }		// { dg-error "this context" }
};

class B {
  typedef int X;			// { dg-error "private" }
  static int i;				// { dg-error "private" }
};

int main()
{
  A<B> ab;				// { dg-message "instantiated" }
  ab.f();				// { dg-message "instantiated" }
}