public:
/// \brief Create an explicitly-written scalar-value initialization
/// expression.
- CXXScalarValueInitExpr(QualType Type,
- TypeSourceInfo *TypeInfo,
- SourceLocation rParenLoc ) :
- Expr(CXXScalarValueInitExprClass, Type, VK_RValue, OK_Ordinary,
- false, false, Type->isInstantiationDependentType(), false),
- RParenLoc(rParenLoc), TypeInfo(TypeInfo) {}
+ CXXScalarValueInitExpr(QualType Type, TypeSourceInfo *TypeInfo,
+ SourceLocation rParenLoc)
+ : Expr(CXXScalarValueInitExprClass, Type, VK_RValue, OK_Ordinary,
+ false, false, Type->isInstantiationDependentType(),
+ Type->containsUnexpandedParameterPack()),
+ RParenLoc(rParenLoc), TypeInfo(TypeInfo) {}
explicit CXXScalarValueInitExpr(EmptyShell Shell)
: Expr(CXXScalarValueInitExprClass, Shell) { }
// (TD) C++ [temp.dep.expr]p3:
// An id-expression is type-dependent if it contains:
//
- // and
+ // and
//
// (VD) C++ [temp.dep.constexpr]p2:
// An identifier is value-dependent if it is:
-
+
// (TD) - an identifier that was declared with dependent type
// (VD) - a name declared with a dependent type,
if (T->isDependentType()) {
bool InstantiationDependent = false;
computeDeclRefDependence(Ctx, getDecl(), getType(), TypeDependent,
ValueDependent, InstantiationDependent);
-
- // (TD) C++ [temp.dep.expr]p3:
- // An id-expression is type-dependent if it contains:
- //
- // and
- //
- // (VD) C++ [temp.dep.constexpr]p2:
- // An identifier is value-dependent if it is:
- if (!TypeDependent && !ValueDependent &&
- hasExplicitTemplateArgs() &&
- TemplateSpecializationType::anyDependentTemplateArguments(
- getTemplateArgs(),
- getNumTemplateArgs(),
- InstantiationDependent)) {
- TypeDependent = true;
- ValueDependent = true;
- InstantiationDependent = true;
- }
-
- ExprBits.TypeDependent = TypeDependent;
- ExprBits.ValueDependent = ValueDependent;
- ExprBits.InstantiationDependent = InstantiationDependent;
-
+
+ ExprBits.TypeDependent |= TypeDependent;
+ ExprBits.ValueDependent |= ValueDependent;
+ ExprBits.InstantiationDependent |= InstantiationDependent;
+
// Is the declaration a parameter pack?
if (getDecl()->isParameterPack())
ExprBits.ContainsUnexpandedParameterPack = true;
: Expr(DeclRefExprClass, T, VK, OK_Ordinary, false, false, false, false),
D(D), Loc(NameInfo.getLoc()), DNLoc(NameInfo.getInfo()) {
DeclRefExprBits.HasQualifier = QualifierLoc ? 1 : 0;
- if (QualifierLoc)
+ if (QualifierLoc) {
getInternalQualifierLoc() = QualifierLoc;
+ auto *NNS = QualifierLoc.getNestedNameSpecifier();
+ if (NNS->isInstantiationDependent())
+ ExprBits.InstantiationDependent = true;
+ if (NNS->containsUnexpandedParameterPack())
+ ExprBits.ContainsUnexpandedParameterPack = true;
+ }
DeclRefExprBits.HasFoundDecl = FoundD ? 1 : 0;
if (FoundD)
getInternalFoundDecl() = FoundD;
Dependent,
InstantiationDependent,
ContainsUnexpandedParameterPack);
- if (InstantiationDependent)
- setInstantiationDependent(true);
+ assert(!Dependent && "built a DeclRefExpr with dependent template args");
+ ExprBits.InstantiationDependent |= InstantiationDependent;
+ ExprBits.ContainsUnexpandedParameterPack |= ContainsUnexpandedParameterPack;
} else if (TemplateKWLoc.isValid()) {
getTemplateKWAndArgsInfo()->initializeFrom(TemplateKWLoc);
}
B<1,2>::C<4,5,6> c1; // expected-note{{in instantiation of}}
B<1,2,3,4>::C<4,5,6> c2; // expected-note{{in instantiation of}}
}
+
+namespace PR21289 {
+ template<int> using T = int;
+ template<typename> struct S { static const int value = 0; };
+ template<typename> const int vt = 0; // expected-warning {{extension}}
+ int f(...);
+ template<int ...Ns> void g() {
+ f(T<Ns>()...);
+ f(S<T<Ns>>::value...);
+ f(vt<T<Ns>>...);
+ }
+ template void g<>();
+ template void g<1, 2, 3>();
+}