1 // { dg-do assemble } 2 3 class foo_a { 4 protected: func(int xi)5 double func(int xi) {return 0.0;} 6 public: foo_a()7 foo_a() {} 8 }; 9 10 class foo_b { 11 public: 12 foo_b(int); 13 foo_b(); 14 ~foo_b(); 15 foo_b(const foo_b&); 16 double& operator()(int); 17 foo_b& operator=(foo_b&); 18 void bar_a(int); 19 }; 20 21 foo_b& operator*(foo_b&, foo_b&); 22 foo_b& operator*(double, foo_b&); 23 24 template <class TP> 25 class foo_c { 26 typedef double (TP::* Tmatf)(int); 27 int m; 28 Tmatf* a; 29 void foo_cinst (int mm); 30 public: 31 foo_c(int mm); foo_c()32 foo_c() {m = 0; a = 0;} ~foo_c()33 ~foo_c() {delete a;} 34 double (TP::*& operator()(int i))(int) {return a[i];} 35 foo_b& bug_func(int); 36 }; 37 38 template <class TP> bug_func(int x)39foo_b& foo_c<TP>::bug_func(int x) { 40 static foo_b retval(m); 41 retval.bar_a(m); 42 for (register int i = 0; i < m; i++) 43 retval(i) = (*(operator()(i)))(x); // { dg-error "invalid use of unary '\\\*'" } 44 return retval; 45 } 46 47 template <class TP> 48 class foo_d { 49 protected: 50 foo_c<TP> bar_b; 51 public: foo_d()52 foo_d() {} ~foo_d()53 virtual ~foo_d() {} 54 virtual void setfoo_c(); 55 }; 56 57 class foo_e : public foo_a, public foo_d<foo_a> { 58 public: 59 foo_e(); ~foo_e()60 ~foo_e() {} 61 void setfoo_c(); 62 }; 63 setfoo_c()64void foo_e::setfoo_c() { 65 bar_b(0) = func; // { dg-error "" } 66 } 67 68 template class foo_c<foo_a>; 69