This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix constexpr evaluation of comparisons involving pointer-to-members


On 12/22/2015 12:07 AM, Patrick Palka wrote:
+  if (code == EQ_EXPR || code == NE_EXPR)
+    {
+      if (TREE_CODE (lhs) == PTRMEM_CST && CONSTANT_CLASS_P (rhs))
+	lhs = cplus_expand_constant (lhs);
+      if (TREE_CODE (rhs) == PTRMEM_CST && CONSTANT_CLASS_P (lhs))
+	rhs = cplus_expand_constant (rhs);
+    }

If both sides are PTRMEM_CST, we should be able to compare them without expanding, using cp_tree_equal.

Jason



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]