diff options
-rw-r--r-- | lib/AST/ExprConstant.cpp | 4 | ||||
-rw-r--r-- | test/CodeGenCXX/pointers-to-data-members.cpp | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 715d30ead0..61f5b136ac 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -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); diff --git a/test/CodeGenCXX/pointers-to-data-members.cpp b/test/CodeGenCXX/pointers-to-data-members.cpp index b2deb31328..41c76d0432 100644 --- a/test/CodeGenCXX/pointers-to-data-members.cpp +++ b/test/CodeGenCXX/pointers-to-data-members.cpp @@ -206,3 +206,14 @@ namespace BoolPtrToMember { return x.*member; } } + +namespace PR8507 { + +struct S; +void f(S* p, double S::*pm) { + if (0 < p->*pm) { + } +} + +} + |