Commit 664beaf2 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/79639 (ICE with -O and constexpr)

	PR c++/79639
	* constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
	call cplus_expand_constant on it first.

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

From-SVN: r245635
parent 956d3e61
2017-02-21 Jakub Jelinek <jakub@redhat.com>
PR c++/79639
* constexpr.c (cxx_eval_store_expression): If *valp is a PTRMEM_CST,
call cplus_expand_constant on it first.
2017-02-19 Jason Merrill <jason@redhat.com>
PR c++/78139 - destructor needed by new-expression
......
......@@ -3517,10 +3517,11 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
wants to modify it. */
if (*valp == NULL_TREE)
{
*valp = new_ctx.ctor = build_constructor (type, NULL);
CONSTRUCTOR_NO_IMPLICIT_ZERO (new_ctx.ctor) = no_zero_init;
*valp = build_constructor (type, NULL);
CONSTRUCTOR_NO_IMPLICIT_ZERO (*valp) = no_zero_init;
}
else
else if (TREE_CODE (*valp) == PTRMEM_CST)
*valp = cplus_expand_constant (*valp);
new_ctx.ctor = *valp;
new_ctx.object = target;
}
......
2017-02-21 Jakub Jelinek <jakub@redhat.com>
PR c++/79639
* g++.dg/cpp1y/constexpr-79639.C: New test.
PR target/79633
* gcc.target/i386/mpx/pr79633.c: New test.
......
// PR c++/79639
// { dg-do compile { target c++14 } }
struct A
{
void foo () {}
void bar () {}
};
typedef void (A::*T) ();
constexpr T
foo (T f)
{
f = 0;
return f;
}
constexpr T
bar (T f)
{
f = &A::bar;
return f;
}
constexpr T a = foo (&A::foo);
constexpr T b = foo (&A::foo);
static_assert (a == nullptr, "");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment