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

--- Comment #4 from Jorg Brown <jorg.brown at gmail dot com> ---
Oddly, if I move the reference to HelloWorld into a separate routine, it works
(you can comment out a() and ba() returns what it should, on gcc 15.0)

struct strt {
  const char *ptr = &data;
  char data = '\0';

  constexpr strt() {}
  constexpr strt(const strt &__str) {}
};
constexpr strt f() { return {}; }
constexpr strt HelloWorld = f();

// This works fine...
const strt &b() { return HelloWorld; }
const char *ba() { return b().ptr; }

// This causes the verify_gimple failure, on gcc 15
const char *a() { return HelloWorld.ptr; }

= - = - = - = - = - = - =

Also odd is that the above code (including a()) works fine on gcc 10.1 through
13.2.  As seen https://godbolt.org/z/z3qnosG37

Reply via email to