fix Issue 11300 - ICE with enums and circular module references
Merge pull request #2683 from 9rnsr/fix11300

[REG2.064a] Issue 11300 - ICE with enums and circular module references