summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 260bee0ff..a4362b912 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -806,10 +806,6 @@ Result linkAndOptimizeIR(
break;
}
- // Lower `Result<T,E>` types into ordinary struct types.
- if (requiredLoweringPassSet.resultType)
- lowerResultType(irModule, sink);
-
#if 0
dumpIRIfEnabled(codeGenContext, irModule, "UNIONS DESUGARED");
#endif
@@ -951,6 +947,12 @@ Result linkAndOptimizeIR(
break;
}
+ // Lower `Result<T,E>` types into ordinary struct types. This must happen
+ // after specialization, since otherwise incompatible copies of the lowered
+ // result structure are generated.
+ if (requiredLoweringPassSet.resultType)
+ lowerResultType(irModule, sink);
+
// Report checkpointing information
if (codeGenContext->shouldReportCheckpointIntermediates())
{