re PR c++/85437 (member pointer static upcast rejected in a constexpr context)
authorJakub Jelinek <jakub@gcc.gnu.org>
Wed, 25 Apr 2018 07:10:16 +0000 (09:10 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 25 Apr 2018 07:10:16 +0000 (09:10 +0200)
commit7d75ea04cf6d9c8960d5c6119d6203568b7069e9
tree0bb4f2c59a7c078ae71479a2a88c3202e7e2c396
parent908553397a611a367ac71670750d7025bffdf5c1
re PR c++/85437 (member pointer static upcast rejected in a constexpr context)

PR c++/85437
PR c++/49171
* cp-tree.h (REINTERPRET_CAST_P): New.
* constexpr.c (cxx_eval_constant_expression) <case NOP_EXPR>:
Reject REINTERPET_CAST_P conversions.  Use cplus_expand_constant
for non-trivial PTRMEM_CST cases.
* typeck.c (build_nop_reinterpret): New.
(build_reinterpret_cast_1): Use it.  Set REINTERPRET_CAST_P on
NOP_EXPRs returned by cp_convert.

* g++.dg/cpp0x/addressof1.C: Make reinterpret cases runtime checks.
* g++.dg/cpp0x/constexpr-cast.C: Remove xfails
* g++.dg/cpp0x/constexpr-nullptr-2.C: Likewise.
* g++.dg/cpp0x/constexpr-pmf1.C: Check when optimized.
* g++.dg/cpp0x/pr85437-1.C: New.
* g++.dg/cpp0x/pr85437-2.C: New.
* g++.dg/cpp0x/pr85437-3.C: New.
* g++.dg/cpp0x/pr85437-4.C: New.

From-SVN: r259629
13 files changed:
gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/cp/cp-tree.h
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/addressof1.C
gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C
gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C
gcc/testsuite/g++.dg/cpp0x/constexpr-pmf1.C
gcc/testsuite/g++.dg/cpp0x/pr85437-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/pr85437-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/pr85437-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/pr85437-4.C [new file with mode: 0644]