In subclause [random.access.iterators], Table 110, the operational semantics for the expression "r -= n" are defined as
return r += -n;
Given a difference_type of a type int with range [-32768, 32767], if the value of n is -32768, then the evaluation of -n causes undefined behaviour (Clause 5 [expr] paragraph 4).
The operational semantics may be changed such that the undefined behaviour is avoided.
Suggested wording:
Replace the operational semantics for "r -= n" with:
{ difference_type m = n; if (m >= 0) while (m--) --r; else while (m++) ++r; return r; }
Jonathan Wakely:
I'm now convinced we don't want to change the definition of -= and instead we should explicitly state the (currently implicit) precondition that n != numeric_limits<difference_type>::min().