Skip to content

Commit da7149a

Browse files
committed
IRGen: Fix overly optimistic assumption in CanPackType::getSingletonPackExpansion()
1 parent f045829 commit da7149a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/AST/ParameterPack.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,12 @@ PackType *PackType::getSingletonPackExpansion(Type param) {
301301
}
302302

303303
CanPackType CanPackType::getSingletonPackExpansion(CanType param) {
304-
return CanPackType(PackType::getSingletonPackExpansion(param));
304+
// Note: You can't just wrap the result in CanPackType() here because
305+
// PackExpansionType has the additional requirement that the count type
306+
// must be a reduced shape.
307+
return cast<PackType>(
308+
PackType::getSingletonPackExpansion(param)
309+
->getCanonicalType());
305310
}
306311

307312
PackExpansionType *PackType::unwrapSingletonPackExpansion() const {

0 commit comments

Comments
 (0)