Topic: Application of "&" operator to reference to incomplete class
Author: dafid@huji.ac.il (David Meiri)
Date: 13 Sep 1993 09:04:45 GMT Raw View
Author: jbuck@forney.berkeley.edu (Joe Buck)
Date: 1 Apr 1993 01:13:15 GMT Raw View
Consider the following code:
class Foo;
void funct_1(Foo*);
void funct_2(Foo& foo_p) {
funct_1(&foo_p);
}
Here we apply the & operator to a reference to an incomplete class, hoping
to obtain the corresponding pointer to the same incomplete class.
Consider, though, that class Foo might overload operator &, meaning that
application of the default meaning of operator & would be incorrect.
Nevertheless, should the compiler accept it? Reference to explicit text
in the ARM would be nice; if it isn't mentioned, I'd appreciate seeing
opinions from the gurus.
--
Joe Buck jbuck@ohm.berkeley.edu