aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-10-19 09:24:57 +0200
committerJakub Jelinek <jakub@redhat.com>2021-10-19 09:24:57 +0200
commitf45610a45236e97616726ca042898d6ac46a082e (patch)
tree766d47e11fff8bea1ceab16e2ce4c35dc6ceb9e2 /gcc/tree-if-conv.c
parentcaab0139761b04226fab14d87c4a4f981d942bbf (diff)
downloadgcc-f45610a45236e97616726ca042898d6ac46a082e.zip
gcc-f45610a45236e97616726ca042898d6ac46a082e.tar.gz
gcc-f45610a45236e97616726ca042898d6ac46a082e.tar.bz2
c++: Don't reject calls through PMF during constant evaluation [PR102786]
The following testcase incorrectly rejects the c initializer, while in the s.*a case cxx_eval_* sees .__pfn reads etc., in the s.*&S::foo case get_member_function_from_ptrfunc creates expressions which use INTEGER_CSTs with type of pointer to METHOD_TYPE. And cxx_eval_constant_expression rejects any INTEGER_CSTs with pointer type if they aren't 0. Either we'd need to make sure we defer such folding till cp_fold but the function and pfn_from_ptrmemfunc is used from lots of places, or the following patch just tries to reject only non-zero INTEGER_CSTs with pointer types if they don't point to METHOD_TYPE in the hope that all such INTEGER_CSTs with POINTER_TYPE to METHOD_TYPE are result of folding valid pointer-to-member function expressions. I don't immediately see how one could create such INTEGER_CSTs otherwise, cast of integers to PMF is rejected and would have the PMF RECORD_TYPE anyway, etc. 2021-10-19 Jakub Jelinek <jakub@redhat.com> PR c++/102786 * constexpr.c (cxx_eval_constant_expression): Don't reject INTEGER_CSTs with type POINTER_TYPE to METHOD_TYPE. * g++.dg/cpp2a/constexpr-virtual19.C: New test.
Diffstat (limited to 'gcc/tree-if-conv.c')
0 files changed, 0 insertions, 0 deletions