public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102220] New: Conversion from cv void* to object-type* not rejected during constant evaluation
@ 2021-09-06 16:51 johelegp at gmail dot com
  2021-09-09  0:08 ` [Bug c++/102220] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: johelegp at gmail dot com @ 2021-09-06 16:51 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/102220] Conversion from cv void* to object-type* not rejected during constant evaluation
  2021-09-06 16:51 [Bug c++/102220] New: Conversion from cv void* to object-type* not rejected during constant evaluation johelegp at gmail dot com
@ 2021-09-09  0:08 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-09  0:08 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-09-09
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-09  0:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 16:51 [Bug c++/102220] New: Conversion from cv void* to object-type* not rejected during constant evaluation johelegp at gmail dot com
2021-09-09  0:08 ` [Bug c++/102220] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).