GCC Bugzilla – Bug 14505
__builtin_constant_p(__func__) is not true
Last modified: 2006-02-18 18:12:00 UTC
The following code emits "non constant" but conceptually should emit "constant". The type of __func__
is "static const char *" so either fold_builtin_constant_p needs to be relaxed a bit or fname_decl should
be building STRING_CST.
int main(int argc, char **argv)
puts (__builtin_constant_p(__func__) ? "constant" : "non constant");
Confirmed on the mainline and on the tree-ssa.
Well note that it cannot be a STRING_CST as the C99 standard defines __func__ as a variable.