__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?

[723 byte] By [mipsmaster] at [2007-11-26 10:27:42]
# 1
I'd say that is a bug. Please file a bug report at bugs.sun.com.
clamage45 at 2007-7-7 2:32:17 > top of Java-index,Development Tools,Solaris and Linux Development Tools...