samples@SEQUOIA.BERKELEY.EDU (12/15/89)
I think this is a bug: I have to leave open the possibility that anything having to do with void* pointers is legitimate, although IMHO it shouldn't. Here is a program that compiles without error, even though one call on the function fcn has no matching signature: <===== Cut Here ======> typedef void *USERTYPE; class BASE { public: void fcn(USERTYPE); }; void BASE::fcn(USERTYPE p) { } class POINTEDTO1 { public: int i; }; class POINTEDTO2 { public: int j; }; typedef POINTEDTO1 *TYPE1; typedef POINTEDTO2 *TYPE2; class DERIVED1 : public BASE { public: void fcn(TYPE1 p) { BASE::fcn(USERTYPE(p)); } }; main() { DERIVED1 obj; TYPE1 v1; TYPE2 v2; obj.fcn(v1); obj.fcn(v2); // there is no function `fcn(TYPE2)' defined // but my compiler doesn't complain. } <===== Cut Here =====> I'm using this technique to define what I call `coercion' classes. Stroustrup uses this technique in his book to define a generic list class. This example was created from a more complicated program that had totally different variable names, class names and typedef names, so I don't think it has anything to do with that. Am I wrong? Or should the compiler complain about that second call on fcn? I'm running g++ version 1.35.0 on a Sun 3/60 running Sun OS 4.0. Compile command: g++ CutHere.C tm.h -> config/tm-sun3+.h md -> config/m68k.md Dain