Fix deep recursion in C++ header type reification
1 files changed, 7 insertions(+), 2 deletions(-)

M src/backends/LLVMModule.h
M src/backends/LLVMModule.h +7 -2
@@ 168,8 168,13 @@ namespace K3 {
 				else if (type.IsInt32()) list.emplace_back("int32_t");
 				else if (type.IsInt64()) list.emplace_back("int64_t");
 				else if (type.IsPair()) {
-					GenerateMembers(type.First(), list);
-					GenerateMembers(type.Rest(), list);
+                    Type current = type;
+                    while(current.IsPair()) {
+                        GenerateMembers(current.First(), list);
+                        current = current.Rest();
+                    }
+                    GenerateMembers(current, list);
+                    
 				} else if (type.IsUserType()) {
 					GenerateMembers(type.UnwrapUserType(), list);
 				} else if (type.IsNativeVector()) {