Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Stefan Kuhlins
Wed, 27 Jan 1993 03:01
overloaded-function-bug
Author: Stefan Kuhlins
Date: Wed, 27 Jan 1993 03:01
Date: Wed, 27 Jan 1993 03:01
54 lines
2179 bytes
2179 bytes
----------
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
*/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads