зеркало из https://github.com/microsoft/clang-1.git
When transforming an InitListExpr, if we already computed a non-dependent type for the InitListExpr, keep it
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86559 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d5a2089663
Коммит
e48319a8a9
|
@ -188,13 +188,11 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
|
|||
Var->setInvalidDecl();
|
||||
else if (!D->getType()->isDependentType() &&
|
||||
!D->getInit()->isTypeDependent() &&
|
||||
!D->getInit()->isValueDependent() &&
|
||||
!isa<InitListExpr>(D->getInit())) {
|
||||
!D->getInit()->isValueDependent()) {
|
||||
// If neither the declaration's type nor its initializer are dependent,
|
||||
// we don't want to redo all the checking, especially since the
|
||||
// initializer might have been wrapped by a CXXConstructExpr since we did
|
||||
// it the first time.
|
||||
// FIXME: The InitListExpr handling here is a hack!
|
||||
Var->setInit(SemaRef.Context, Init.takeAs<Expr>());
|
||||
}
|
||||
else if (ParenListExpr *PLE = dyn_cast<ParenListExpr>((Expr *)Init.get())) {
|
||||
|
|
|
@ -1063,8 +1063,18 @@ public:
|
|||
/// Subclasses may override this routine to provide different behavior.
|
||||
OwningExprResult RebuildInitList(SourceLocation LBraceLoc,
|
||||
MultiExprArg Inits,
|
||||
SourceLocation RBraceLoc) {
|
||||
return SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc);
|
||||
SourceLocation RBraceLoc,
|
||||
QualType ResultTy) {
|
||||
OwningExprResult Result
|
||||
= SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc);
|
||||
if (Result.isInvalid() || ResultTy->isDependentType())
|
||||
return move(Result);
|
||||
|
||||
// Patch in the result type we were given, which may have been computed
|
||||
// when the initial InitListExpr was built.
|
||||
InitListExpr *ILE = cast<InitListExpr>((Expr *)Result.get());
|
||||
ILE->setType(ResultTy);
|
||||
return move(Result);
|
||||
}
|
||||
|
||||
/// \brief Build a new designated initializer expression.
|
||||
|
@ -3893,7 +3903,7 @@ TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E,
|
|||
return SemaRef.Owned(E->Retain());
|
||||
|
||||
return getDerived().RebuildInitList(E->getLBraceLoc(), move_arg(Inits),
|
||||
E->getRBraceLoc());
|
||||
E->getRBraceLoc(), E->getType());
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
|
|
Загрузка…
Ссылка в новой задаче