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

            Bug ID: 91415
           Summary: Invalid warning for C++17 sequencing of shift operator
                    E1<<E2.
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: maxim.yegorushkin at gmail dot com
  Target Milestone: ---

When compiling the following code with g++ (Ubuntu 8.3.0-6ubuntu1~18.04.1)
8.3.0, flags -std=gnu++17 -W{all,extra,error}

int main() {
    int i = 0;
    int j = i++ << i++;
}

The following warning/error is produced:

test.cc:3:14: error: operation on ā€˜iā€™ may be undefined [-Werror=sequence-point]
     int j = i++ << i++;
             ~^~

Whereas C++17 in Shift operators [expr.shift] requires that in E1 << E2 the
expression E1 is sequenced before the expression E2.

Reply via email to