re PR c++/56998 (ICE in value_dependent_expression_p, at cp/pt.c:19598)
authorJason Merrill <jason@redhat.com>
Tue, 14 May 2013 12:49:08 +0000 (08:49 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 14 May 2013 12:49:08 +0000 (08:49 -0400)
PR c++/56998
* semantics.c (potential_constant_expression_1): Make sure the
called function is potentially constant.
* call.c (null_ptr_cst_p): Revert earlier change.

From-SVN: r198881

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/semantics.c

index 38b43d51d3e1e931c92fe9fc2d95afc3e8322213..aca1ece1010359dfb389087521999ed64750bcb0 100644 (file)
@@ -1,3 +1,10 @@
+2013-05-14  Jason Merrill  <jason@redhat.com>
+
+       PR c++/56998
+       * semantics.c (potential_constant_expression_1): Make sure the
+       called function is potentially constant.
+       * call.c (null_ptr_cst_p): Revert earlier change.
+
 2013-05-13  Jason Merrill  <jason@redhat.com>
 
        PR c++/56998
index 9f3a50d47d2167be13f95c7d65b53e8d28a8890e..bd8f531eea4ae38fd22890017972166fd0bbdc88 100644 (file)
@@ -554,7 +554,7 @@ null_ptr_cst_p (tree t)
   if (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)))
     {
       /* Core issue 903 says only literal 0 is a null pointer constant.  */
-      if (cxx_dialect < cxx0x && !TREE_SIDE_EFFECTS (t))
+      if (cxx_dialect < cxx0x)
        t = maybe_constant_value (fold_non_dependent_expr_sfinae (t, tf_none));
       STRIP_NOPS (t);
       if (integer_zerop (t) && !TREE_OVERFLOW (t))
index 3e78887ca2f5090b23d2cd3c411a82ed1836bc08..92a4917fb404837c79d9037ff2dea18bd3835a97 100644 (file)
@@ -8476,7 +8476,11 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
                  }
              }
            else
-             fun = get_first_fn (fun);
+             {
+               if (!potential_constant_expression_1 (fun, true, flags))
+                 return false;
+               fun = get_first_fn (fun);
+             }
            /* Skip initial arguments to base constructors.  */
            if (DECL_BASE_CONSTRUCTOR_P (fun))
              i = num_artificial_parms_for (fun);