diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-02-08 02:14:35 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-02-08 02:14:35 +0000 |
| commit | a57a66e8d02d30c8b2fe5db85d4de52f22c66646 (patch) | |
| tree | d304b6b2dfabd49fb34f7a04360b0fb9ad711122 /clang/lib/Sema | |
| parent | bec0285d7fb33b68042a59bcf9277500a3261052 (diff) | |
| download | bcm5719-llvm-a57a66e8d02d30c8b2fe5db85d4de52f22c66646.tar.gz bcm5719-llvm-a57a66e8d02d30c8b2fe5db85d4de52f22c66646.zip | |
Sema::MaybeBindToTemporary() shouldn't treat any expression returning
a glvalue as a temporary. Previously, we were enumerating all of the
cases that coul return glvalues and might be called with
Sema::MaybeBindToTemporary(), but that was gross and we missed the
Objective-C property reference case.
llvm-svn: 125070
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 81031a54eed..ea1ad51e9d6 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -3370,17 +3370,9 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) { if (!RT) return Owned(E); - // If this is the result of a call or an Objective-C message send expression, - // our source might actually be a reference, in which case we shouldn't bind. - if (CallExpr *CE = dyn_cast<CallExpr>(E)) { - if (CE->getCallReturnType()->isReferenceType()) - return Owned(E); - } else if (ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(E)) { - if (const ObjCMethodDecl *MD = ME->getMethodDecl()) { - if (MD->getResultType()->isReferenceType()) - return Owned(E); - } - } + // If the result is a glvalue, we shouldn't bind it. + if (E->Classify(Context).isGLValue()) + return Owned(E); // That should be enough to guarantee that this type is complete. // If it has a trivial destructor, we can avoid the extra copy. |

