8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-pmf1.C
Jakub Jelinek 7d75ea04cf 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
2018-04-25 09:10:16 +02:00

18 lines
445 B
C

// PR c++/77775
// { dg-options "-fdump-tree-fre1 -O1" }
// { dg-final { scan-tree-dump "== viewAdded" "fre1" { target c++11 } } }
namespace Sublime {
struct View;
struct AreaIndex;
struct Area {
void qt_static_metacall();
void viewAdded(AreaIndex *, View *);
};
}
void Sublime::Area::qt_static_metacall() {
typedef void (Area::*_t)(AreaIndex *, View *);
if (*reinterpret_cast<_t *>(1) == _t(&Area::viewAdded))
__builtin_abort();
}