This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


2087. Left shift of negative value by zero bits

Section: 7.6.7  [expr.shift]     Status: NAD     Submitter: Mattheus Izvekov     Date: 2015-02-16

A shift of zero bits should result in the left operand regardless of its sign. However, the current wording of 7.6.7 [expr.shift] paragraph 2 makes it undefined behavior.

Notes from the February, 2016 meeting:

CWG felt that a reasonable approach might be to define <<N as equivalent to multiplying by 2N in all cases; see also the resolution of issue 1457. The resolution of this question should also be coordinated with SG6 and SG12, as well as with WG14.

Rationale (February, 2019):

This issue is resolved by the adoption of paper P1236.