forked from OSchip/llvm-project
Don't crash if we deserialize a pack expansion type whose pattern
contains no packs.
Fixes a regression from 740a164dec
.
This commit is contained in:
parent
93c678a79b
commit
234f51a65a
|
@ -722,7 +722,8 @@ let Class = PackExpansionType in {
|
|||
}
|
||||
|
||||
def : Creator<[{
|
||||
return ctx.getPackExpansionType(pattern, numExpansions);
|
||||
return ctx.getPackExpansionType(pattern, numExpansions,
|
||||
/*ExpectPackInType*/false);
|
||||
}]>;
|
||||
}
|
||||
|
||||
|
|
|
@ -1498,7 +1498,8 @@ ASTNodeImporter::VisitPackExpansionType(const PackExpansionType *T) {
|
|||
return ToPatternOrErr.takeError();
|
||||
|
||||
return Importer.getToContext().getPackExpansionType(*ToPatternOrErr,
|
||||
T->getNumExpansions());
|
||||
T->getNumExpansions(),
|
||||
/*ExpactPack=*/false);
|
||||
}
|
||||
|
||||
ExpectedType ASTNodeImporter::VisitDependentTemplateSpecializationType(
|
||||
|
|
|
@ -19,3 +19,8 @@ shared_ptr<int> spi = shared_ptr<int>::allocate_shared(1, 2);
|
|||
template<int> struct A {};
|
||||
template<int> struct B {};
|
||||
outer<int, int>::inner<1, 2, A, B> i(A<1>{}, B<2>{});
|
||||
|
||||
void test_nondependent_pack() {
|
||||
take_nondependent_pack<int, int>(nullptr, nullptr);
|
||||
take_nondependent_pack_2<int, int>({});
|
||||
}
|
||||
|
|
|
@ -23,3 +23,8 @@ template<typename...Ts> struct outer {
|
|||
};
|
||||
};
|
||||
template struct outer<int, int>;
|
||||
|
||||
template<typename ...T> void take_nondependent_pack(int (...arr)[sizeof(sizeof(T))]);
|
||||
|
||||
template<typename T> using hide = int;
|
||||
template<typename ...T> void take_nondependent_pack_2(outer<hide<T>...>);
|
||||
|
|
|
@ -39,6 +39,8 @@ int init_capture(T t) {
|
|||
return [&, x(t)] { return sizeof(x); };
|
||||
}
|
||||
|
||||
auto with_pack = [](auto ...xs){};
|
||||
|
||||
#else
|
||||
|
||||
// CHECK-PRINT: T add_slowly
|
||||
|
@ -55,4 +57,6 @@ int add(int x, int y) {
|
|||
// CHECK-PRINT: init_capture
|
||||
// CHECK-PRINT: [&, x(t)]
|
||||
|
||||
void use_with_pack() { with_pack(1, 2, 3); }
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,8 @@ template <SizedLike<char> T> void h(T) {}
|
|||
template <SizedLike<int> T> void i(T) {}
|
||||
template <SizedLike T> void i(T) {}
|
||||
|
||||
void j(SizedLike<int> auto ...ints) {}
|
||||
|
||||
#else /*included pch*/
|
||||
|
||||
int main() {
|
||||
|
@ -35,6 +37,7 @@ int main() {
|
|||
(void)h(1);
|
||||
(void)i('1');
|
||||
(void)i(1);
|
||||
(void)j(1, 2, 3);
|
||||
}
|
||||
|
||||
#endif // HEADER
|
||||
#endif // HEADER
|
||||
|
|
Loading…
Reference in New Issue