fix Issue 12040 - Compiler segfault with circular reference in variable type
Merge pull request #3178 from 9rnsr/fix12040

Issue 12040 - Compiler segfault with circular reference in variable type