aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/template/using17.C
blob: 1af1dc71e4e831446d43251ac81d4db5e6482a05 (plain)
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
// PR c++/14258
// { dg-do run }

template<typename T>
struct A 
{
  typedef T type;
  typedef A type2;
};
                                                                               
template<typename T>
struct B : A<T> 
{
  using typename A<T>::type;
  type t;

  using typename A<T>::type2;

  type f()
  {
    type i = 1;
    return i;
  }
};

int main()
{
  B<int>::type t = 4;
  if (t != 4)
    __builtin_abort();

  B<double> b;
  b.t = 3;
  if (b.t != 3)
    __builtin_abort();

  B<long> b2;
  if (b2.f() != 1)
    __builtin_abort();

  B<double>::type2::type tt = 12;
  if (tt != 12)
    __builtin_abort();
}