summaryrefslogtreecommitdiffstats
path: root/source/slang/legalize-types.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-05-25 10:01:34 -0400
committerTim Foley <tfoleyNV@users.noreply.github.com>2018-05-25 07:01:34 -0700
commitace9a8dc7e4353b1cf8e846abe2b8dc53ecdbc59 (patch)
tree172670d128c557ede1bccd18c3d1ea5611ff0e94 /source/slang/legalize-types.cpp
parent18709fbaa03fe0ef0727a802d864fae6c5163fc0 (diff)
Fixes 574. Eliminate empty structs during type legalization (#577)
Diffstat (limited to 'source/slang/legalize-types.cpp')
-rw-r--r--source/slang/legalize-types.cpp6
1 files changed, 6 insertions, 0 deletions
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