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())) {
/// 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.
return SemaRef.Owned(E->Retain());
return getDerived().RebuildInitList(E->getLBraceLoc(), move_arg(Inits),
- E->getRBraceLoc());
+ E->getRBraceLoc(), E->getType());
}
template<typename Derived>