diff mbox

C++ PATCH to remove obsolete cases from potential_constant_expression_1

Message ID 553A582B.5070405@redhat.com
State New
Headers show

Commit Message

Jason Merrill April 24, 2015, 2:50 p.m. UTC
potential_constant_expression_1 originally implemented an early version 
of the constexpr proposal, which included a concept of "potential 
constant expression" that no longer exists in the standard.  It's still 
useful for catching expressions that could never be constant, but these 
two are obsolete.

Tested x86_64-pc-linux-gnu, applying to trunk.
diff mbox

Patch

commit f7ac4fd6b541a7b07fc041e1300c7169672dc97e
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Apr 23 17:19:49 2015 -0400

    	* constexpr.c (potential_constant_expression_1) [MINUS_EXPR]:
    	Remove obsolete code.
    	[NE_EXPR]: Likewise.

diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 2990519..6465677 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -4156,15 +4156,6 @@  potential_constant_expression_1 (tree t, bool want_rval, bool strict,
       }
 
     case MINUS_EXPR:
-      /* -- a subtraction where both operands are pointers.   */
-      if (TYPE_PTR_P (TREE_OPERAND (t, 0))
-          && TYPE_PTR_P (TREE_OPERAND (t, 1)))
-        {
-          if (flags & tf_error)
-            error ("difference of two pointer expressions is not "
-                   "a constant expression");
-          return false;
-        }
       want_rval = true;
       goto binary;
 
@@ -4174,16 +4165,6 @@  potential_constant_expression_1 (tree t, bool want_rval, bool strict,
     case GE_EXPR:
     case EQ_EXPR:
     case NE_EXPR:
-      /* -- a relational or equality operator where at least
-            one of the operands is a pointer.  */
-      if (TYPE_PTR_P (TREE_OPERAND (t, 0))
-          || TYPE_PTR_P (TREE_OPERAND (t, 1)))
-        {
-          if (flags & tf_error)
-            error ("pointer comparison expression is not a "
-                   "constant expression");
-          return false;
-        }
       want_rval = true;
       goto binary;