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

--- Comment #1 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> ---
See also PR118462 -- I'm not sure if these are duplicates or not; this one
requires the variable to be declared `const`. However, GCC does reject this
simplified testcase with a lifetime error:

constexpr int f() {
  const int *p = 0;
  {
    const int n = 0;
    p = &n;
  }
  return *p;
}
static_assert(f() == 0);

... suggesting that reentering the scope where `n` was declared is relevant.

Reply via email to