1// PR c++/9634, c++/29469, c++/29607
2// Contributed by: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3// DR224: Make sure that a name is *truly* semantically dependent.
4
5struct D {
6  typedef int K;
7};
8
9template <typename T>
10struct A
11{
12  typedef int Bar;
13
14  template <typename>
15  struct N {};
16
17  typedef Bar          type1;
18  typedef A::Bar       type2;
19  typedef A<T>::Bar    type3;
20  typedef A<T*>::Bar    type4;  // { dg-error "" }
21  typedef typename A<T*>::Bar type5;
22
23  typedef N<int>       type6;
24  typedef A::N<int>    type7;
25  typedef A<T>::N<int> type8;
26  typedef A<T*>::template N<int> type9;  // { dg-error "" }
27  typedef typename A<T*>::template N<int> type10;
28
29  typedef D Bar2;
30  struct N2 { typedef int K; };
31
32  // Check that A::N2 is still considered dependent (because it
33  //  could be specialized), while A::Bar2 (being just ::D) is not.
34  typedef A::Bar2 type11;
35  typedef type11::K k3;
36
37  typedef A::N2 type12;
38  typedef typename type12::K k2;
39  typedef type12::K k1;  // { dg-error "" }
40
41  // Check that A::Bar2 is not considered dependent even if we use
42  // the typename keyword.
43  typedef typename A::Bar2 type13;
44  typedef type13::K k4;
45};
46