PR18152: When computing the semantic form for an initializer list, keep track

of whether the initializer list is dependent.

llvm-svn: 196558
This commit is contained in:
Richard Smith 2013-12-06 01:27:24 +00:00
parent d5944cd118
commit c275da6a14
3 changed files with 17 additions and 2 deletions

View File

@ -3774,6 +3774,14 @@ public:
void setInit(unsigned Init, Expr *expr) {
assert(Init < getNumInits() && "Initializer access out of range!");
InitExprs[Init] = expr;
if (expr) {
ExprBits.TypeDependent |= expr->isTypeDependent();
ExprBits.ValueDependent |= expr->isValueDependent();
ExprBits.InstantiationDependent |= expr->isInstantiationDependent();
ExprBits.ContainsUnexpandedParameterPack |=
expr->containsUnexpandedParameterPack();
}
}
/// \brief Reserve space for some number of initializers.

View File

@ -1867,12 +1867,12 @@ void InitListExpr::resizeInits(const ASTContext &C, unsigned NumInits) {
Expr *InitListExpr::updateInit(const ASTContext &C, unsigned Init, Expr *expr) {
if (Init >= InitExprs.size()) {
InitExprs.insert(C, InitExprs.end(), Init - InitExprs.size() + 1, 0);
InitExprs.back() = expr;
setInit(Init, expr);
return 0;
}
Expr *Result = cast_or_null<Expr>(InitExprs[Init]);
InitExprs[Init] = expr;
setInit(Init, expr);
return Result;
}

View File

@ -93,3 +93,10 @@ namespace PR10837 {
}
template struct A<int>;
}
namespace PR18152 {
template<int N> struct A {
static const int n = {N};
};
template struct A<0>;
}