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 | f4ee1ddfa28529ab77076b39e23070d79c7d867c (patch) | |
| tree | 2120a921f349b4f449fa6d74034f06a3a6aea8f2 /clang/lib/AST | |
| parent | 0bdb1fd4775648d63033ba20cdaf90fd34f8ce3d (diff) | |
| download | bcm5719-llvm-f4ee1ddfa28529ab77076b39e23070d79c7d867c.tar.gz bcm5719-llvm-f4ee1ddfa28529ab77076b39e23070d79c7d867c.zip | |
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.
llvm-svn: 114071
Diffstat (limited to 'clang/lib/AST')
| -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; } |

