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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Or rather,

int main()
{
  constexpr const int &r = 42;
  static_assert(r == 42); // { dg-bogus "" }
}

[expr.const]/4.7 says that "a temporary object of non-volatile const-qualified
literal type whose lifetime is extended to that
of a variable that is usable in constant expressions" is usable in a constant
expression.

Reply via email to