This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
RE: c++/9942: Function Overload Resolution calls wrong function on variable length parameter lists
- From: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
- To: Steve Wadsworth <Steve_Wadsworth at portasystems dot co dot uk>
- Cc: "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>, "'gcc-gnats at gcc dot gnu dot org'" <gcc-gnats at gcc dot gnu dot org>
- Date: Wed, 5 Mar 2003 17:03:00 -0600 (CST)
- Subject: RE: c++/9942: Function Overload Resolution calls wrong function on variable length parameter lists
> Attached is sample code to exhibit this.
OK, here's a reduced example:
------------------------
#include <stdarg.h>
void f(int, va_list&) ; // only declared
void f(int, ...) {}; // defined
int main () {
char *p;
f(1, p); // should probably call second f()
}
------------------------
This compiles and links fine with 2.95, but not with 3.2.1. Will have to
check on that other system what happens with 3.3 and mainline.
W.
Here's the result:
tmp/g> ~/bin/gcc-3.2.1/bin/c++ x.cc
/tmp/ccOD0xO1.o: In function `main':
/tmp/ccOD0xO1.o(.text+0x25): undefined reference to `f(int, char*&)'
collect2: ld returned 1 exit status
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth at ticam dot utexas dot edu
www: http://www.ticam.utexas.edu/~bangerth/