[cfe-commits] r117850 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/CodeGenCXX/pointers-to-data-members.cpp
Anders Carlsson
andersca at mac.com
Sat Oct 30 18:21:48 PDT 2010
Author: andersca
Date: Sat Oct 30 20:21:47 2010
New Revision: 117850
URL: http://llvm.org/viewvc/llvm-project?rev=117850&view=rev
Log:
Don't try to evaluate the LHS or RHS of a member pointer binary operation. Fixes PR8507.
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=117850&r1=117849&r2=117850&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Sat Oct 30 20:21:47 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/trunk/test/CodeGenCXX/pointers-to-data-members.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp?rev=117850&r1=117849&r2=117850&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/pointers-to-data-members.cpp Sat Oct 30 20:21:47 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 cfe-commits
mailing list