[llvm-branch-commits] [cfe-branch] r118534 - in /cfe/branches/Apple/whitney: lib/AST/ExprConstant.cpp test/CodeGenCXX/pointers-to-data-members.cpp

Daniel Dunbar daniel at zuster.org
Tue Nov 9 09:30:13 PST 2010


Author: ddunbar
Date: Tue Nov  9 11:30:13 2010
New Revision: 118534

URL: http://llvm.org/viewvc/llvm-project?rev=118534&view=rev
Log:
Merge r117850:
--
Author: Anders Carlsson <andersca at mac.com>
Date:   Sun Oct 31 01:21:47 2010 +0000

    Don't try to evaluate the LHS or RHS of a member pointer binary operation. Fixes PR8507.

Modified:
    cfe/branches/Apple/whitney/lib/AST/ExprConstant.cpp
    cfe/branches/Apple/whitney/test/CodeGenCXX/pointers-to-data-members.cpp

Modified: cfe/branches/Apple/whitney/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/AST/ExprConstant.cpp?rev=118534&r1=118533&r2=118534&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/AST/ExprConstant.cpp (original)
+++ cfe/branches/Apple/whitney/lib/AST/ExprConstant.cpp Tue Nov  9 11:30:13 2010
@@ -1966,6 +1966,10 @@
     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);

Modified: cfe/branches/Apple/whitney/test/CodeGenCXX/pointers-to-data-members.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/test/CodeGenCXX/pointers-to-data-members.cpp?rev=118534&r1=118533&r2=118534&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/test/CodeGenCXX/pointers-to-data-members.cpp (original)
+++ cfe/branches/Apple/whitney/test/CodeGenCXX/pointers-to-data-members.cpp Tue Nov  9 11:30:13 2010
@@ -206,3 +206,14 @@
     return x.*member;
   }
 }
+
+namespace PR8507 {
+  
+struct S;
+void f(S* p, double S::*pm) {
+  if (0 < p->*pm) {
+  }
+}
+
+}
+





More information about the llvm-branch-commits mailing list