c++: constexpr PMF conversion [PR105996]
commitc4792bd1de0621932a47fb86aca09fafafdb2972
authorJason Merrill <jason@redhat.com>
Thu, 23 Mar 2023 20:50:09 +0000 (23 16:50 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 23 Mar 2023 21:38:29 +0000 (23 17:38 -0400)
treef6d57832dfe5d9b6f4f015331245cecac41c42bc
parent3fbeff66684d95417646aaa22d0a8f1ec9786299
c++: constexpr PMF conversion [PR105996]

Here, we were calling build_reinterpret_cast regardless of whether there was
actually a cast, and that now sets REINTERPRET_CAST_P.  But that
optimization seems dodgy anyway, as it involves NOP_EXPR from one
RECORD_TYPE to another and we try to reserve NOP_EXPR for fundamental types.
And the generated code seems the same, so let's drop it.  And also strip
location wrappers.

PR c++/105996

gcc/cp/ChangeLog:

* typeck.cc (build_ptrmemfunc): Drop 0-offset optimization
and location wrappers.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/constexpr-pmf3.C: New test.
gcc/cp/typeck.cc
gcc/testsuite/g++.dg/cpp0x/constexpr-pmf3.C [new file with mode: 0644]