https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80794
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #6) > (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. I agree about foo but not about the call in bar. Also you cannot use the undefinedness found in foo (that is the call to f in foo cannot change the object) with the bar [if they are in the same translation unit] as foo might not be called at runtime (and it is only runtime undefinedness).