diff options
| author | Yong He <yonghe@outlook.com> | 2024-03-18 17:59:08 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-18 17:59:08 -0700 |
| commit | 2bfde345291a6f7b07865abbd0a48ec5bf4a4b61 (patch) | |
| tree | b616e9d5a5262ceb0bd6566ccdb6ec11972b81a0 | |
| parent | 26e25f6e73a9808ad93c98ad34907e3a27b6726c (diff) | |
Check cyclic types after specialization. (#3791)
| -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 |
