aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/template/crash113.C
blob: 3d3a562bdcd518d0386534a2bde64657cc92327c (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
45
46
47
48
49
50
// PR c++/53581

template<class A, int M, int N>
class Child;

template<class A, int M, int N>
class Base
{
public:
  Child<A, M, N> operator-(const Base<A, M, N> &m) const
  {
    Child<A, M, N> diff;
    return diff;
  }

  A test() const
  {
    return 0;
  }

private:
  A values[M * N];
};

template<class A, int N>
class Ops
{
public:
  virtual ~Ops() {}

  bool bar() const
  {
    Child<A, N, N> mat;
    return (*static_cast<const Child<A, N, N>*>(this) - mat).test();
  }
};


template<class A, int N>
class Child<A, N, N> : public Base<A, N, N>, public Ops<A, N> {};

class ImageWarp
{
  bool bar() const
  {
    return foo.bar();
  }

  Child<float, 3, 3> foo;
};