diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 11 | 
1 files changed, 8 insertions, 3 deletions
| diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index f3285ec390b..4c6822c041f 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -1659,9 +1659,10 @@ bool Expr::isTemporaryObject(ASTContext &C, const CXXRecordDecl *TempTy) const {    // Temporaries are by definition pr-values of class type.    if (!E->Classify(C).isPRValue()) return false; -  // Black-list implicit derived-to-base conversions, which are the -  // only way we can get a pr-value of class type that doesn't refer -  // to a temporary of that type. +  // Black-list a few cases which yield pr-values of class type that don't +  // refer to temporaries of that type: + +  // - implicit derived-to-base conversions    if (isa<ImplicitCastExpr>(E)) {      switch (cast<ImplicitCastExpr>(E)->getCastKind()) {      case CK_DerivedToBase: @@ -1672,6 +1673,10 @@ bool Expr::isTemporaryObject(ASTContext &C, const CXXRecordDecl *TempTy) const {      }    } +  // - member expressions (all) +  if (isa<MemberExpr>(E)) +    return false; +    return true;  } | 

