This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Call of overloaded function is ambiguous ?



g++ from GCC 2.95.3 produces an error message with the following code:

/* [...] */

void f ( unsigned int ) { }
void f ( void * ) { }

int main ( void )
{
  f ( 0 ) ;

  return 0 ;
}

/* [...] */

test.cxx: In function `int main()':
test.cxx:6: call of overloaded `f (int)' is ambiguous
test.cxx:1: candidates are: void f(unsigned int)
test.cxx:2:                 void f(void *)


Although the same code with 'int' instead of 'unsigned int' works fine:

/* [...] */

void f ( int ) { }
void f ( void * ) { }

int main ( void )
{
  f ( 0 ) ;

  return 0 ;
}

/* [...] */

(No error message here)


Now, I am confused ...


Thanks in advance,

Sebastian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]