This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
size_t overloading ambiguity
- From: corey taylor <corey dot taylor at gmail dot com>
- To: gcc help <gcc-help at gcc dot gnu dot org>
- Date: Tue, 22 Feb 2005 23:03:48 -0600
- Subject: size_t overloading ambiguity
- Reply-to: corey taylor <corey dot taylor at gmail dot com>
Hello all,
This issue was reported by our OSX tester/developer using GCC. I
cannot produce the results under linux gcc 3.3 or so.
The problem *appears* to be that unsigned int and long unsigned int
and other typedefs with these values are implicitly converting or
something instead of properly matching the overload of unsigned int.
The code below will create an overload ambiguity with the OSX gcc.
The same happens for size_t.
#include <stdio.h>
#include <stddef.h>
void foo (int x)
{
printf("Foo of int");
}
void foo (unsigned int x)
{
printf("Foo of unsigned int");
}
int main (int argc, char* argv[])
{
printf("sizeof(unsigned int): %d\n", sizeof(unsigned int));
printf("sizeof(size_t): %d\n", sizeof(size_t));
printf("sizeof(long unsigned int): %d\n", sizeof(long unsigned
int));
long unsigned int a = 1;
foo(a);
}
corey