Minimal test: --- struct RBNode { RBNode *copy = new RBNode; }
What should happen? CTFE should detect and guard against stack overflow?
In this instance, it should detect and guard against stack overflow, because the value of the initializer is indeed recursive. Consider the following, that would cause a stack overflow at runtime: --- struct RBNode { RBNode *copy; this(int num) { this.copy = new RBNode(num++); } } ---
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/265e42a2bf63a89f27878fada44e9eb7892e319b fix Issue 18057 - [ICE] Segmentation fault (stack overflow) in Expression::ctfeInterpret() https://github.com/dlang/dmd/commit/74285e41e670bf7e2ae7d83bc9b1617e12f93a65 Merge pull request #7701 from ibuclaw/fix18507 fix Issue 18057 - [ICE] Segmentation fault (stack overflow) in Expression::ctfeInterpret() merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/8d6d1ea638e92f85b2af9fb83c2c019e38a0afe3 testsuite: Add another test for issue 18057 https://github.com/dlang/dmd/commit/de0782f642913cabb72bc91cf4d81209f035c6e2 Merge pull request #9285 from ibuclaw/fail18057b testsuite: Add another test for issue 18057 merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>