summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-01-16 00:00:48 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-01-16 00:00:48 +0000
commit1fcf66b0dd41802b572052869df6fa6fec13e0fd (patch)
treea0fd3f0abe7a46f24eb50ca5d0d3f90621ab112d /clang/lib/Sema
parent6d8f59e65f1232b953428f72ccc7f86d904e77b7 (diff)
downloadbcm5719-llvm-1fcf66b0dd41802b572052869df6fa6fec13e0fd.tar.gz
bcm5719-llvm-1fcf66b0dd41802b572052869df6fa6fec13e0fd.zip
Make the AST explicitly represent the cast of the first operand of a
pointer-to-member operator. llvm-svn: 93592
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 1ad931e5416..e4812682a08 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1450,12 +1450,14 @@ QualType Sema::CheckPointerToMemberOperands(
// overkill?
if (!IsDerivedFrom(LType, Class, Paths) ||
Paths.isAmbiguous(Context.getCanonicalType(Class))) {
- const char *ReplaceStr = isIndirect ? ".*" : "->*";
Diag(Loc, diag::err_bad_memptr_lhs) << OpSpelling
- << (int)isIndirect << lex->getType() <<
- CodeModificationHint::CreateReplacement(SourceRange(Loc), ReplaceStr);
+ << (int)isIndirect << lex->getType();
return QualType();
}
+ // Cast LHS to type of use.
+ QualType UseType = isIndirect ? Context.getPointerType(Class) : Class;
+ bool isLValue = !isIndirect && lex->isLvalue(Context) == Expr::LV_Valid;
+ ImpCastExprToType(lex, UseType, CastExpr::CK_DerivedToBase, isLValue);
}
if (isa<CXXZeroInitValueExpr>(rex->IgnoreParens())) {
OpenPOWER on IntegriCloud