From f9438bbb2e36eea2a61d09ee268704aff4f15d81 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 27 Nov 2016 23:00:36 -0500 Subject: [PATCH] PR c++/77907 - static init and PMF * constexpr.c (cxx_eval_constant_expression): Use cp_fold_convert. From-SVN: r242906 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/constexpr.c | 2 +- gcc/testsuite/g++.dg/cpp0x/pr77907.C | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 20b356ff3db..c6bc06fc241 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-11-27 Jason Merrill + + PR c++/77907 + * constexpr.c (cxx_eval_constant_expression): Use cp_fold_convert. + 2016-11-24 Martin Liska PR bootstrap/78493 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 40d1e7be782..f93dd4713c0 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -4226,7 +4226,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, { if (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (op))) - STRIP_NOPS (t); + return cp_fold_convert (type, op); else { if (!ctx->quiet) diff --git a/gcc/testsuite/g++.dg/cpp0x/pr77907.C b/gcc/testsuite/g++.dg/cpp0x/pr77907.C index d46c7078b97..8128e8cde62 100644 --- a/gcc/testsuite/g++.dg/cpp0x/pr77907.C +++ b/gcc/testsuite/g++.dg/cpp0x/pr77907.C @@ -1,6 +1,7 @@ // PR c++/77907 // { dg-do run { target c++11 } } -// { dg-options "-O2" } +// { dg-options "-O2 -save-temps" } +// { dg-final { scan-assembler-not "static_initialization" } } struct A { int foo () { return 1; } -- 2.30.2