Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!kth!draken!Urd!newsuser From: newsuser@LTH.Se (LTH network news server) Newsgroups: comp.lang.c++ Subject: Bug in AT&T C++ 1.2 Summary: Nasty bug, trivial example Message-ID: <1989Apr10.140143.19639@LTH.Se> Date: 10 Apr 89 13:01:43 GMT Reply-To: dag@Control.LTH.Se (Dag Bruck) Organization: Dept. of Automatic Control, Lund Inst. of Technology, Sweden Lines: 45 I have just found bug AT&T cfront 1.2. It may be well-known to many people, but maybe not to everybody. (Is this the last possibility to report bugs on 1.2 ? (:-)) Source program follows: class C { public: void f(float); virtual void g(float); }; main () { C x; x.f(1); // ok x.g(1); // error } Calling the non-virtual C::f(), the integer 1 is converted to a floating point 1. Calling the virtual C::g(), no conversion takes place. My compiler (with the fixes supplied with InterViews) produces this main program (#line directives removed): int main (){ _main(); { struct C _au1_x ; ( ( ((& _au1_x )-> _C__vptr = C__vtbl), (((& _au1_x )))) ) ; _C_f ( & _au1_x , (float )1 ) ; (*(((char (*)())(*(& _au1_x )-> _C__vptr ))))( & _au1_x , 1 ) ; } }; Dag Bruck -- Department of Automatic Control Internet: dag@control.lth.se Lund Institute of Technology P. O. Box 118 Phone: +46 46-108779 S-221 00 Lund, SWEDEN Fax: +46 46-138118