PR c++/77907 - static init and PMF
authorJason Merrill <jason@redhat.com>
Mon, 28 Nov 2016 04:00:36 +0000 (23:00 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 28 Nov 2016 04:00:36 +0000 (23:00 -0500)
* constexpr.c (cxx_eval_constant_expression): Use cp_fold_convert.

From-SVN: r242906

gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/testsuite/g++.dg/cpp0x/pr77907.C

index 20b356ff3dbe5b07dfcd11d121c88be11dd53efd..c6bc06fc241cd62b052b40dc3099da218442568f 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-27  Jason Merrill  <jason@redhat.com>
+
+       PR c++/77907
+       * constexpr.c (cxx_eval_constant_expression): Use cp_fold_convert.
+
 2016-11-24  Martin Liska  <mliska@suse.cz>
 
        PR bootstrap/78493
index 40d1e7be7825e63543f5b9be51dd959b94ebd54f..f93dd4713c0c3903834183c226f40197312f8385 100644 (file)
@@ -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)
index d46c7078b97f8752af393e56c8fae0a68973b968..8128e8cde622433ea19b294daf6d45e28cc6a5be 100644 (file)
@@ -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; }