diff options
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index dfa472cc26b..a9a3b2c8ce4 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1748,22 +1748,25 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, ExprTy, Loc, false, constAdded); QualType T = VD->getType(); - if (getLangOptions().CPlusPlus && !T->isDependentType() && - !T->isReferenceType()) { - Expr *E = new (Context) - DeclRefExpr(const_cast<ValueDecl*>(BDRE->getDecl()), T, - SourceLocation()); + if (getLangOptions().CPlusPlus) { + if (!T->isDependentType() && !T->isReferenceType()) { + Expr *E = new (Context) + DeclRefExpr(const_cast<ValueDecl*>(BDRE->getDecl()), T, + SourceLocation()); - OwningExprResult Res = PerformCopyInitialization( - InitializedEntity::InitializeBlock(VD->getLocation(), + OwningExprResult Res = PerformCopyInitialization( + InitializedEntity::InitializeBlock(VD->getLocation(), T, false), - SourceLocation(), - Owned(E)); - if (!Res.isInvalid()) { - Res = MaybeCreateCXXExprWithTemporaries(move(Res)); - Expr *Init = Res.takeAs<Expr>(); - BDRE->setCopyConstructorExpr(Init); + SourceLocation(), + Owned(E)); + if (!Res.isInvalid()) { + Res = MaybeCreateCXXExprWithTemporaries(move(Res)); + Expr *Init = Res.takeAs<Expr>(); + BDRE->setCopyConstructorExpr(Init); + } } + else if (T->isDependentType()) + BDRE->setTypeDependent(true); } return Owned(BDRE); } |

