https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118629
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, first of all, what it really should refer to at that point? I mean auto foo() -> decltype(static_cast<const char*>(__PRETTY_FUNCTION__)) { return nullptr; } compiles, but actually will create a toplevel __PRETTY_FUNCTION__ VAR_DECL initialized to "top level". So template <int N> struct S { char s[N]; }; const char *z; auto foobarbaz() -> S<sizeof (__PRETTY_FUNCTION__)> { z = __PRETTY_FUNCTION__; return {}; } int bar() { return sizeof (foobarbaz ()); } returns 10 from bar, rather than rather than 18 for "S<10> foobarbaz()". It behaves the same in clang++ though (except for using even larger pretty function name stored to z, but still bar returns 10).