summaryrefslogtreecommitdiffstats
path: root/source/slang/emit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/emit.cpp')
-rw-r--r--source/slang/emit.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index e0f71aafe..3f88ab82d 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -2363,15 +2363,18 @@ struct EmitVisitor
// for temporary variables.
auto type = inst->getDataType();
- // First we unwrap any layers of pointer-ness and array-ness
- // from the types to get at the underlying data type.
- while (auto ptrType = as<IRPtrTypeBase>(type))
+ // Unwrap any layers of array-ness from the type, so that
+ // we can look at the underlying data type, in case we
+ // should *never* expose a value of that type
+ while (auto arrayType = as<IRArrayTypeBase>(type))
{
- type = ptrType->getValueType();
+ type = arrayType->getElementType();
}
- while (auto ptrType = as<IRArrayTypeBase>(type))
+
+ // Don't allow temporaries of pointer types to be created.
+ if(as<IRPtrTypeBase>(type))
{
- type = ptrType->getElementType();
+ return true;
}
// First we check for uniform parameter groups,