summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/ir-legalize-types.cpp2
-rw-r--r--source/slang/legalize-types.cpp6
2 files changed, 8 insertions, 0 deletions
diff --git a/source/slang/ir-legalize-types.cpp b/source/slang/ir-legalize-types.cpp
index 86907dfde..df3e190e1 100644
--- a/source/slang/ir-legalize-types.cpp
+++ b/source/slang/ir-legalize-types.cpp
@@ -818,6 +818,8 @@ static LegalVal legalizeInst(
args,
inst->getOperandCount());
+ case kIROp_undefined:
+ return LegalVal();
default:
// TODO: produce a user-visible diagnostic here
SLANG_UNEXPECTED("non-simple operand(s)!");
diff --git a/source/slang/legalize-types.cpp b/source/slang/legalize-types.cpp
index bbfa6264d..6ab597d93 100644
--- a/source/slang/legalize-types.cpp
+++ b/source/slang/legalize-types.cpp
@@ -301,6 +301,12 @@ struct TupleTypeBuilder
LegalType getResult()
{
+ // If this is an empty struct, return a none type
+ // This helps get rid of emtpy structs that often trips up the
+ // downstream compiler
+ if (!anyOrdinary && !anySpecial && !anyComplex)
+ return LegalType::tuple(new TuplePseudoType());
+
// If we didn't see anything "special"
// then we can use the type as-is.
// we can conceivably just use the type as-is