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

            Bug ID: 110394
           Summary: Lambda capture receives wrong value
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jackyguo18 at hotmail dot com
  Target Milestone: ---

Note that this doesn't occur in Clang, and to my knowledge, disabling strict
aliasing and overflow would make no difference.

The code submitted here is actually part of a larger library. When I go to
debug it, a lambda in `GetKeys(int index, BUTTONS* keys)` captures the wrong
value for `index`--it should be 0, but it's 23.

Changing the capture type from value to reference causes the lambda to
inexplicably call the address 0x17 (decimal 23).

Reply via email to