Problem with extern "C"
Andrew Morton
morton@nortelnetworks.com
Sun Oct 24 05:49:00 GMT 1999
Using the EGCS which came out of CVS yesterday. Linux/x86.
I'm trying to work out if this is actually a bug. I think it is.
Consider this code:
extern int callback(void (*func)(void));
extern "C" {
void foo();
};
void bar()
{
callback(foo);
}
bix:~> g++ t.cc
t.cc: In function `void bar ()':
t.cc:9: cannot convert `void (*) (...)' to `void (*) ()' for argument
`1' to `callback (void (*) ())'
If the 'extern "C"' wrapper is removed from the declaration of 'foo()'
it compiles OK.
If the declaration of foo is changed to 'foo(void)' it compiles OK.
More information about the Gcc-bugs
mailing list