[Prev][Next][Index]

operator->() bug



pC++2dep gives an error message while making a dep file for the
following legal code:

------------------------------8<------------------------------
class A {
public:
  int i;
};

class B {
  A* ptr;
public:
  B(A& a) : ptr( &a ) {}
  A* operator->() { return ptr; }
};

int main() {
  A a;
  B b( a );

  b.operator->()->i;
  b->i;
}
------------------------------8<------------------------------

The error message is:

Error on line 18 of bug.cc:   not a proper member or union/struct requierd

but the previous line (line 17) parses ok.  The two have equivalent
meanings in this context.

I looked at parser_lib.c where the err() function is called with this
argument in the checkFieldDecl() function.

Adam

_______________________________________________________________
email:aba@dcs.exeter.ac.uk        http://dcs.exeter.ac.uk/~aba/