@@ -19849,20 +19849,16 @@ static void DoMarkVarDeclReferenced(
19849
19849
SemaRef.InstantiateVariableDefinition(PointOfInstantiation, Var);
19850
19850
});
19851
19851
19852
- if (auto *DRE = dyn_cast_or_null<DeclRefExpr>(E)) {
19853
- // Re-set the member to trigger a recomputation of the dependence bits
19854
- // for the expression.
19852
+ // The size of an incomplete array type can be updated by
19853
+ // instantiating the initializer. The DeclRefExpr's type should be
19854
+ // updated accordingly too, or users of it would be confused!
19855
+ SemaRef.getCompletedType(E);
19856
+
19857
+ // Re-set the member to trigger a recomputation of the dependence bits
19858
+ // for the expression.
19859
+ if (auto *DRE = dyn_cast_or_null<DeclRefExpr>(E))
19855
19860
DRE->setDecl(DRE->getDecl());
19856
- // The size of an incomplete array type can be updated by
19857
- // instantiating the initializer. The DeclRefExpr's type should be
19858
- // updated accordingly too, or users of it would be confused!
19859
- //
19860
- // FIXME: Do we need to recompute the type for all the Decls, as in
19861
- // BuildDeclarationNameExpr?
19862
- if (SemaRef.Context.getAsIncompleteArrayType(DRE->getType()) &&
19863
- !SemaRef.Context.getAsIncompleteArrayType(Var->getType()))
19864
- DRE->setType(Var->getType());
19865
- } else if (auto *ME = dyn_cast_or_null<MemberExpr>(E))
19861
+ else if (auto *ME = dyn_cast_or_null<MemberExpr>(E))
19866
19862
ME->setMemberDecl(ME->getMemberDecl());
19867
19863
} else if (FirstInstantiation) {
19868
19864
SemaRef.PendingInstantiations
0 commit comments