summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/Expr.cpp2
-rw-r--r--clang/lib/Sema/SemaExpr.cpp5
2 files changed, 2 insertions, 5 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 5c0e38cf9e7..6e62d09474c 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -325,7 +325,7 @@ bool Expr::hasLocalSideEffect() const {
/// DeclCanBeLvalue - Determine whether the given declaration can be
/// an lvalue. This is a helper routine for isLvalue.
static bool DeclCanBeLvalue(const NamedDecl *Decl, ASTContext &Ctx) {
- return isa<VarDecl>(Decl) ||
+ return isa<VarDecl>(Decl) || isa<CXXFieldDecl>(Decl) ||
// C++ 3.10p2: An lvalue refers to an object or function.
(Ctx.getLangOptions().CPlusPlus &&
(isa<FunctionDecl>(Decl) || isa<OverloadedFunctionDecl>(Decl)));
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 5619eca4f00..070db2b5b9f 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -402,10 +402,7 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
if (FD->isInvalidDecl())
return true;
- // FIXME: Use DeclRefExpr or a new Expr for a direct CXXField reference.
- ExprResult ThisExpr = ActOnCXXThis(SourceLocation());
- return new MemberExpr(static_cast<Expr*>(ThisExpr.Val),
- true, FD, Loc, FD->getType());
+ return new DeclRefExpr(FD, FD->getType(), Loc);
}
return Diag(Loc, diag::err_invalid_non_static_member_use, FD->getName());
OpenPOWER on IntegriCloud