diff options
author | John McCall <rjmccall@apple.com> | 2011-06-30 17:15:34 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-06-30 17:15:34 +0000 |
commit | 0b645e90301d66c96187be4867c8ef88c218fd0d (patch) | |
tree | 9d8002d2e5e29181cdf8da620eb7cfd577b03bf9 /clang/lib/Sema/SemaExprCXX.cpp | |
parent | bfee88a0cff4fcf2da9a0e0d90ef479e7559636f (diff) | |
download | bcm5719-llvm-0b645e90301d66c96187be4867c8ef88c218fd0d.tar.gz bcm5719-llvm-0b645e90301d66c96187be4867c8ef88c218fd0d.zip |
Perform lvalue-to-rvalue conversions on both operands of ->*
and the RHS of .*. Noticed by Enea Zaffanella!
llvm-svn: 134170
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 100681df5e6..8dc9ceef9f8 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -3168,6 +3168,20 @@ QualType Sema::CheckPointerToMemberOperands(ExprResult &lex, ExprResult &rex, ExprValueKind &VK, SourceLocation Loc, bool isIndirect) { + assert(!lex.get()->getType()->isPlaceholderType() && + !rex.get()->getType()->isPlaceholderType() && + "placeholders should have been weeded out by now"); + + // The LHS undergoes lvalue conversions if this is ->*. + if (isIndirect) { + lex = DefaultLvalueConversion(lex.take()); + if (lex.isInvalid()) return QualType(); + } + + // The RHS always undergoes lvalue conversions. + rex = DefaultLvalueConversion(rex.take()); + if (rex.isInvalid()) return QualType(); + const char *OpSpelling = isIndirect ? "->*" : ".*"; // C++ 5.5p2 // The binary operator .* [p3: ->*] binds its second operand, which shall |