home *** CD-ROM | disk | FTP | other *** search
- 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
- From: kuhlins@anne.wifo.uni-mannheim.de (Stefan Kuhlins)
- Newsgroups: gnu.g++.bug
- Subject: overloaded-function-bug
- Date: 26 Jan 1993 22:01:29 -0500
- Organization: GNUs Not Usenet
- Lines: 55
- Sender: daemon@cis.ohio-state.edu
- Approved: bug-g++@prep.ai.mit.edu
- Distribution: gnu
- Message-ID: <9301261150.AA05285@anne.wifo.uni-mannheim.de>
-
- ----------
- X-Sun-Data-Type: text
- X-Sun-Data-Description: text
- X-Sun-Data-Name: text
- X-Sun-Content-Lines: 0
-
- ----------
- X-Sun-Data-Type: default
- X-Sun-Data-Description: default
- X-Sun-Data-Name: gnubug.C
- X-Sun-Content-Lines: 42
-
- // This programm contains 2 errors, which g++ 2.3.1 does not detect.
-
- #include <iostream.h>
-
- void h (float) { cout << "h1" << endl; }
- void h (double) { cout << "h2" << endl; }
-
- void f () { cout << "f1" << endl; }
- void f (int = 1) { cout << "f2" << endl; }
-
- int main()
- {
- h(3); // error 1, g++ calls h1()
- f(); // error 2, g++ calls f1()
- return 0;
- }
-
- /*
- error 1: ambiguous call: h ( int )
- choice of h()s:
- h(float );
- h(double );
-
- error 2: ambiguous call: f ()
- choice of f()s:
- f();
- f(int );
-
-
- g++ output:
-
- # g++ -v gnubug.C
- Reading specs from /vol/lang/gcc/lib/gcc-lib/sparc-sun-sunos4.1.2/2.3.1/specs
- gcc version 2.3.1
- /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
- GNU CPP version 2.3.1 (sparc)
- /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
- GNU C++ version 2.3.1 (sparc) compiled by GNU C version 2.3.1.
- as -o /usr/tmp/cca105741.o /usr/tmp/cca10574.s
- /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
-
- */
-
-