]> granicus.if.org Git - clang/commitdiff
Don't try to evaluate the LHS or RHS of a member pointer binary operation. Fixes...
authorAnders Carlsson <andersca@mac.com>
Sun, 31 Oct 2010 01:21:47 +0000 (01:21 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 31 Oct 2010 01:21:47 +0000 (01:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117850 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprConstant.cpp
test/CodeGenCXX/pointers-to-data-members.cpp

index 715d30ead0c8aacb763c8b508c53191815e8ea0f..61f5b136ac0b079c8972746da93c78ed85a578ce 100644 (file)
@@ -1966,6 +1966,10 @@ bool FloatExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
     return true;
   }
 
+  // We can't evaluate pointer-to-member operations.
+  if (E->isPtrMemOp())
+    return false;
+
   // FIXME: Diagnostics?  I really don't understand how the warnings
   // and errors are supposed to work.
   APFloat RHS(0.0);
index b2deb313287f5a28f5910923156e4bdb9125fcdb..41c76d0432b865a3ea64eb791403e00557f29129 100644 (file)
@@ -206,3 +206,14 @@ namespace BoolPtrToMember {
     return x.*member;
   }
 }
+
+namespace PR8507 {
+  
+struct S;
+void f(S* p, double S::*pm) {
+  if (0 < p->*pm) {
+  }
+}
+
+}
+