]> gcc.gnu.org Git - gcc.git/commit
c++: ICE with reinterpret_cast and switch [PR113545]
authorMarek Polacek <polacek@redhat.com>
Fri, 16 Feb 2024 17:25:26 +0000 (12:25 -0500)
committerMarek Polacek <polacek@redhat.com>
Fri, 16 Feb 2024 17:25:26 +0000 (12:25 -0500)
commite501a279fb4298c9b23637d573287e059b3b06c8
treecf7db3e95e236f3bbc2d14c23d6abf3e00d46f25
parentebe00c9d3a0436dec5c354a62d98e444d763ff95
c++: ICE with reinterpret_cast and switch [PR113545]

Jason, this is the patch you proposed for PR113545.  It looks very safe
so I'm posting it here so that it's not forgotten.

PR c++/113545

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_switch_expr): If the condition doesn't reduce
to an INTEGER_CST, consider it non-constant.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1y/constexpr-reinterpret3.C: New test.
* g++.dg/cpp1y/constexpr-reinterpret4.C: New test.

(cherry picked from commit 39d989022dd0eacf1a7b95b7b20621acbe717d70)
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret4.C [new file with mode: 0644]
This page took 0.060861 seconds and 5 git commands to generate.