forked from OSchip/llvm-project
Fix for PR5524: make reference binding in default argument work correctly.
llvm-svn: 91733
This commit is contained in:
parent
57f2a6187a
commit
357e8c94d6
|
@ -97,7 +97,10 @@ RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E,
|
|||
bool IsInitializer) {
|
||||
bool ShouldDestroyTemporaries = false;
|
||||
unsigned OldNumLiveTemporaries = 0;
|
||||
|
||||
|
||||
if (const CXXDefaultArgExpr *DAE = dyn_cast<CXXDefaultArgExpr>(E))
|
||||
E = DAE->getExpr();
|
||||
|
||||
if (const CXXExprWithTemporaries *TE = dyn_cast<CXXExprWithTemporaries>(E)) {
|
||||
ShouldDestroyTemporaries = true;
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm-only -verify
|
||||
|
||||
struct A {};
|
||||
struct B : A {};
|
||||
void a(const A& x = B());
|
||||
void b() { a(); }
|
Loading…
Reference in New Issue