зеркало из https://github.com/microsoft/clang-1.git
Fix a slight oversight in computing whether a copy constructor is elidable.
Fixes PR5695. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90702 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
2ffb14f004
Коммит
0336843eb0
|
@ -3369,8 +3369,10 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
|
|||
if (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E))
|
||||
if (ICE->getCastKind() == CastExpr::CK_NoOp)
|
||||
E = ICE->getSubExpr();
|
||||
|
||||
if (isa<CallExpr>(E) || isa<CXXTemporaryObjectExpr>(E))
|
||||
|
||||
if (CallExpr *CE = dyn_cast<CallExpr>(E))
|
||||
Elidable = !CE->getCallReturnType()->isReferenceType();
|
||||
else if (isa<CXXTemporaryObjectExpr>(E))
|
||||
Elidable = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
|
||||
// PR5695
|
||||
|
||||
struct A { A(const A&); ~A(); };
|
||||
A& a();
|
||||
void b() {
|
||||
A x = a();
|
||||
}
|
||||
|
||||
// CHECK: call void @_ZN1AC1ERKS_
|
||||
// CHECK: call void @_ZN1AD1Ev
|
Загрузка…
Ссылка в новой задаче