c++ - bug in dmc 8.42n
- BCS <BCS_member pathlink.com> Dec 07 2005
DMC allows code to get a pointer to an overloaded function without enough
context to tell which function should be used. It appears to just pick the first
one that was encountered. (This bug also exists in DMD 0.141)
example:
#include <stdio.h>
// switch these and output line 3 changes
char fn(char c) { return c; }
int fn(int i) { return i; }
int main(int argc, char *argv[])
{
char(*fnc)(char) = &fn;
int(*fni)(int) = &fn;
printf("fn(char)\t%p\n", fnc);
printf("fn(int) \t%p\n", fni);
printf("fn(?) \t%p\n", &fn);
return 0;
}
Dec 07 2005








BCS <BCS_member pathlink.com>