summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/net31.C
blob: 8bc159b136ea744c9d80360c4b8b7ea2ee4d9e0b (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// { dg-do assemble  }

class foo_a {
  protected:
        double func(int xi) {return 0.0;}
  public:
        foo_a() {}
};

class foo_b {
  public:
        foo_b(int);
        foo_b();
        ~foo_b();
        foo_b(const foo_b&);
        double& operator()(int);
        foo_b& operator=(foo_b&);
        void bar_a(int);
};

foo_b& operator*(foo_b&, foo_b&);
foo_b& operator*(double, foo_b&);

template <class TP>
class foo_c {
        typedef double (TP::* Tmatf)(int);
        int m;
        Tmatf* a;
        void foo_cinst (int mm);
  public:
        foo_c(int mm);
        foo_c() {m = 0; a = 0;}
        ~foo_c() {delete a;}
        double (TP::*& operator()(int i))(int) {return a[i];}
        foo_b& bug_func(int);
};

template <class TP>
foo_b& foo_c<TP>::bug_func(int x) {
        static foo_b retval(m);
        retval.bar_a(m);
        for (register int i = 0; i < m; i++)
	  retval(i) = (*(operator()(i)))(x);		// { dg-error "invalid use of unary '\\\*'" } 
        return retval;
}

template <class TP>
class foo_d {
  protected:
        foo_c<TP> bar_b;
  public:
        foo_d() {}
        virtual ~foo_d() {}
        virtual void setfoo_c();
};

class foo_e : public foo_a, public foo_d<foo_a> {
  public:
        foo_e();
        ~foo_e() {}
        void setfoo_c();
};

void foo_e::setfoo_c() {
        bar_b(0) = func;				// { dg-error "" } 
}

template class foo_c<foo_a>;