diff options
| -rw-r--r-- | source/slang/slang-emit.cpp | 2 | ||||
| -rw-r--r-- | tests/bugs/cyclic-type-2.slang | 24 |
2 files changed, 26 insertions, 0 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 649858e51..70dddb4f6 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -14,6 +14,7 @@ #include "slang-ir-composite-reg-to-mem.h" #include "slang-ir-dce.h" #include "slang-ir-diff-call.h" +#include "slang-ir-check-recursive-type.h" #include "slang-ir-autodiff.h" #include "slang-ir-defunctionalization.h" #include "slang-ir-dll-export.h" @@ -475,6 +476,7 @@ Result linkAndOptimizeIR( break; } + checkForRecursiveTypes(irModule, sink); if (sink->getErrorCount() != 0) return SLANG_FAIL; diff --git a/tests/bugs/cyclic-type-2.slang b/tests/bugs/cyclic-type-2.slang new file mode 100644 index 000000000..b7e2aa448 --- /dev/null +++ b/tests/bugs/cyclic-type-2.slang @@ -0,0 +1,24 @@ + +//TEST:SIMPLE(filecheck=CHECK):-target spirv -emit-spirv-directly + +// CHECK: error 41001: + +interface IFoo {} +struct TA<T:IFoo> : IFoo +{ + TB<T> tb; +} + +struct TB<T:IFoo> +{ + TA<T> ta[2]; +} + +struct TC : IFoo {} + +[numthreads(1,1,1)] +void main() +{ + TA<TC> ta; + ta.tb.ta[0] = ta; +}
\ No newline at end of file |
