home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / g / bug / 2346 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.1 KB  |  68 lines

  1. Path: sparky!uunet!stanford.edu!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!anne.wifo.uni-mannheim.de!kuhlins
  2. From: kuhlins@anne.wifo.uni-mannheim.de (Stefan Kuhlins)
  3. Newsgroups: gnu.g++.bug
  4. Subject: overloaded-function-bug
  5. Date: 26 Jan 1993 22:01:29 -0500
  6. Organization: GNUs Not Usenet
  7. Lines: 55
  8. Sender: daemon@cis.ohio-state.edu
  9. Approved: bug-g++@prep.ai.mit.edu
  10. Distribution: gnu
  11. Message-ID: <9301261150.AA05285@anne.wifo.uni-mannheim.de>
  12.  
  13. ----------
  14. X-Sun-Data-Type: text
  15. X-Sun-Data-Description: text
  16. X-Sun-Data-Name: text
  17. X-Sun-Content-Lines: 0
  18.  
  19. ----------
  20. X-Sun-Data-Type: default
  21. X-Sun-Data-Description: default
  22. X-Sun-Data-Name: gnubug.C
  23. X-Sun-Content-Lines: 42
  24.  
  25. // This programm contains 2 errors, which g++ 2.3.1 does not detect.
  26.  
  27. #include <iostream.h>
  28.  
  29. void h (float)  { cout << "h1" << endl; }
  30. void h (double) { cout << "h2" << endl; }
  31.  
  32. void f ()        { cout << "f1" << endl; }
  33. void f (int = 1) { cout << "f2" << endl; }
  34.  
  35. int main()
  36. {
  37.   h(3);       // error 1, g++ calls h1()
  38.   f();        // error 2, g++ calls f1()
  39.   return 0;
  40. }
  41.  
  42. /*
  43. error 1: ambiguous call: h ( int )
  44.   choice of h()s:
  45.      h(float );
  46.      h(double );
  47.  
  48. error 2: ambiguous call: f ()
  49.   choice of f()s:
  50.      f();
  51.      f(int );
  52.  
  53.  
  54. g++ output:
  55.  
  56. # g++ -v gnubug.C
  57. Reading specs from /vol/lang/gcc/lib/gcc-lib/sparc-sun-sunos4.1.2/2.3.1/specs
  58. gcc version 2.3.1
  59.  /vol/lang/gcc/lib/gcc-lib/sparc-sun-sunos4.1.2/2.3.1/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix gnubug.C /usr/tmp/cca10574.i
  60. GNU CPP version 2.3.1 (sparc)
  61.  /vol/lang/gcc/lib/gcc-lib/sparc-sun-sunos4.1.2/2.3.1/cc1plus /usr/tmp/cca10574.i -quiet -dumpbase gnubug.cc -version -o /usr/tmp/cca10574.s
  62. GNU C++ version 2.3.1 (sparc) compiled by GNU C version 2.3.1.
  63.  as -o /usr/tmp/cca105741.o /usr/tmp/cca10574.s
  64.  /vol/lang/gcc/lib/gcc-lib/sparc-sun-sunos4.1.2/2.3.1/ld -e start -dc -dp /lib/crt0.o -L/vol/lang/gcc/lib/gcc-lib/sparc-sun-sunos4.1.2/2.3.1 -L/vol/lang/gcc/lib /usr/tmp/cca105741.o -lg++ -lgcc -lc -lgcc
  65.  
  66. */
  67.  
  68.