https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97154
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #8 from Martin Sebor <msebor at gcc dot gnu.org> --- Yes, it's valid. spec.back() is specified as equivalent to spec.operator[](spec.size() - 1). libstdc++-v3/include/bits/stl_vector.h implements back() as: /** * Returns a read/write reference to the data at the last * element of the %vector. */ reference back() _GLIBCXX_NOEXCEPT { __glibcxx_requires_nonempty(); return *(end() - 1); } spec.back() is shorter and arguably clearer so if someone would like to change the code I'd support it.