__func__ doesn't expand in function calls
The following code gets the error
line 12: Error: __func__ is not defined.
[code]
#include <stdio.h>
class Tracer {
public:
Tracer(const char * caller) {
printf("Function name is %s.\n", caller);
}
};
int main(int, char**)
{
Tracer tr(__func__);
}
[/code]
But this works fine.
[code]
#include <stdio.h>
class Tracer {
public:
Tracer(const char * caller) {
printf("Function name is %s.\n", caller);
}
};
int main(int, char**)
{
const char * name = __func__;
Tracer tr(name);
}
[/code]
Why? Is there another workaround?

