Commit 4a58d2fe by Marek Polacek Committed by Marek Polacek

re PR c++/83116 (Statement with no effect causes wrong code of static object constexpr method)

	PR c++/83116
	* constexpr.c (cxx_eval_call_expression): Only look into
	constexpr_call_table if ctx->strict.

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

From-SVN: r255788
parent aa8ec7fb
2017-12-18 Marek Polacek <polacek@redhat.com>
PR c++/83116
* constexpr.c (cxx_eval_call_expression): Only look into
constexpr_call_table if ctx->strict.
2017-12-18 Jakub Jelinek <jakub@redhat.com>
PR c++/83300
......
......@@ -1588,7 +1588,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
tree result = NULL_TREE;
constexpr_call *entry = NULL;
if (depth_ok && !non_constant_args)
if (depth_ok && !non_constant_args && ctx->strict)
{
new_call.hash = iterative_hash_template_arg
(new_call.bindings, constexpr_fundef_hasher::hash (new_call.fundef));
......
2017-12-18 Marek Polacek <polacek@redhat.com>
PR c++/83116
* g++.dg/cpp1y/constexpr-83116.C: New test.
2017-12-18 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/83424
......
// PR c++/83116
// { dg-do run { target c++14 } }
// { dg-options "-O2" }
struct S {
constexpr S () : s(0) { foo (); }
constexpr int foo () { return s; }
int s;
};
int
main ()
{
static S var;
var.s = 5;
if (var.s != 5 || var.foo () != 5)
__builtin_abort ();
}
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