diff options
author | John McCall <rjmccall@apple.com> | 2010-09-16 06:57:56 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-09-16 06:57:56 +0000 |
commit | 19e60ad937af50843a653fa19c8be6a83a64f24f (patch) | |
tree | feb52ab5f7a9ca37b84dc80ea34c18cf592303d8 /lib/AST/Expr.cpp | |
parent | b25938303de0976b9f189363d43033e5788e3d36 (diff) |
Right, there are *two* cases of pr-value class-type expressions that don't
derive from temporaries of the same type. Black-list member expressions
as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index f3285ec390..4c6822c041 100644 --- a/lib/AST/Expr.cpp +++ b/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; } |