Skip to content

Commit aa8f87a

Browse files
committed
IRGen: Fix emitPackShapeExpression() with empty pack
1 parent fee32cc commit aa8f87a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/IRGen/GenPack.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ llvm::Value *IRGenFunction::emitPackShapeExpression(CanType type) {
161161
if (pair.first > 0) {
162162
auto *constant = llvm::ConstantInt::get(IGM.SizeTy, pair.first);
163163
accumulateSum(*this, pair.second, constant);
164+
} else if (pair.second == nullptr) {
165+
pair.second = llvm::ConstantInt::get(IGM.SizeTy, 0);
164166
}
165167

166168
setScopedLocalTypeData(type, kind, pair.second);

test/Interpreter/variadic_generic_types.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ struct G<T...> {
1111
}
1212
}
1313

14+
// CHECK: ()
15+
G< >().makeTuple()
16+
1417
// CHECK: (Array<Int>, Array<String>, Array<Float>)
1518
G<Int, String, Float>().makeTuple()

0 commit comments

Comments
 (0)