[Bug c++/77557] gcc doesn't warn about code (clang does), __PRETTY_FUNCTION__ used in struct in function

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Sep 11 07:53:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77557

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The question comes down to the following is NSDMI considered part of the
constructor or not.  If not then GCC is correct here and depends on the
following code is valid or not:
#include <stdio.h>
void fn () {
  static const char *d = __PRETTY_FUNCTION__;
        struct getter {
                const char * fn = d;
        };
        printf ("%s\n",getter().fn);
};


More information about the Gcc-bugs mailing list