public InheritingConcreteTypeLoc<ArrayTypeLoc,
DependentSizedArrayTypeLoc,
DependentSizedArrayType> {
-
+public:
+ void initializeLocal(ASTContext &Context, SourceLocation Loc) {
+ ArrayTypeLoc::initializeLocal(Context, Loc);
+ setSizeExpr(getTypePtr()->getSizeExpr());
+ }
};
class VariableArrayTypeLoc :
transformFunctionTypeParam(ParmVarDecl *OldParam,
MultiLevelTemplateArgumentList &Args) {
TypeSourceInfo *OldDI = OldParam->getTypeSourceInfo();
- TypeSourceInfo *NewDI =
- Args.getNumLevels()
- ? SemaRef.SubstType(OldDI, Args, OldParam->getLocation(),
- OldParam->getDeclName())
- : OldDI;
+ TypeSourceInfo *NewDI;
+ if (!Args.getNumLevels())
+ NewDI = OldDI;
+ else if (auto PackTL = OldDI->getTypeLoc().getAs<PackExpansionTypeLoc>()) {
+ // Expand out the one and only element in each inner pack.
+ Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, 0);
+ NewDI =
+ SemaRef.SubstType(PackTL.getPatternLoc(), Args,
+ OldParam->getLocation(), OldParam->getDeclName());
+ if (!NewDI) return nullptr;
+ NewDI =
+ SemaRef.CheckPackExpansion(NewDI, PackTL.getEllipsisLoc(),
+ PackTL.getTypePtr()->getNumExpansions());
+ } else
+ NewDI = SemaRef.SubstType(OldDI, Args, OldParam->getLocation(),
+ OldParam->getDeclName());
if (!NewDI)
return nullptr;
};
D d(Y<0, 1, 2>{});
}
+
+namespace variadic {
+ int arr3[3], arr4[4];
+
+ // PR32673
+ template<typename T> struct A {
+ template<typename ...U> A(T, U...);
+ };
+ A a(1, 2, 3);
+
+ template<typename T> struct B {
+ template<int ...N> B(T, int (&...r)[N]);
+ };
+ B b(1, arr3, arr4);
+
+ template<typename T> struct C {
+ template<template<typename> typename ...U> C(T, U<int>...);
+ };
+ C c(1, a, b);
+
+ template<typename ...U> struct X {
+ template<typename T> X(T, U...);
+ };
+ X x(1, 2, 3);
+
+ template<int ...N> struct Y {
+ template<typename T> Y(T, int (&...r)[N]);
+ };
+ Y y(1, arr3, arr4);
+
+ template<template<typename> typename ...U> struct Z {
+ template<typename T> Z(T, U<int>...);
+ };
+ Z z(1, a, b);
+}