[Bug c++/21614] New: invokation of undefined class'es method is ignored

yuri at tsoft dot com gcc-bugzilla@gcc.gnu.org
Tue May 17 06:14:00 GMT 2005


gcc 4.0.0 generates code that has line (**) ignored (nothing is invoked in it's
place).

I am not sure in what kind of relationship does this code stand with C++ standard.

But although structure X::Z is undefined, technically method Y::r can be invoked
safely since X::Z definition isn't required for this.

This code used to compile and work fine -- line (**) was invoked.

Yuri


--begin code--
class X;
class Y;

class X {
public:
  struct Z;
  typedef void (Z::* R) (unsigned int ss);

  void   rr (unsigned int ss);

  Y*    d;
};

class Y {
public:
  X::R  r;
  X::Z* d;
  Y*    n;
  Y(X::R _r, X::Z* _d) : r(_r), d(_d) { }
};

extern void ck();

void  X::rr (unsigned int ss) {
  for (Y* l = d;  l;  l = l->n) {
    ck();
    ((l->d)->*(l->r))(ss); // (**) ignored line
    ck();
  }
}
--end code--

-- 
           Summary: invokation of undefined class'es method is ignored
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yuri at tsoft dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21614



More information about the Gcc-bugs mailing list