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

            Bug ID: 102220
           Summary: Conversion from cv void* to object-type* not rejected
                    during constant evaluation
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/ecYjGsWo7.
```C++
#include <cassert>
int main() {
  [i=0]() consteval /*mutable*/ {
    ++*(int*)(void*)&i;
    assert(i == 1);
  }();
}
```

A minimal reproduction:
```C++
int main() {
  [i=0]() consteval {
    (void)+*(const int*)(const void*)&i;
  }();
}
```

Discovered at
https://cpplang.slack.com/archives/C263VAF2B/p1630942490163700?thread_ts=1630937296.159200&cid=C263VAF2B.

Reply via email to