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

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #5)
> S::i cannot change during the lifetime of an S object because S::i is
> declared const.  This holds regardless of whether the S object itself is
> const.

To be clear, the only way to change S::i is to destroy S or S::i and create a
new object in its storage.  That can be relied on not to happen in s.foo()
because the reference s is seen used after the function returns.

Reply via email to