Thread overview
[Issue 19411] Visual D Intellisense chokes on static ifs
December 06
https://issues.dlang.org/show_bug.cgi?id=19411

Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario@gmx.de

--- Comment #1 from Rainer Schuetze <r.sagitario@gmx.de> ---
I just tried to reproduce this with a series of more than 2000 "static if(size_t.sizeof == 4) {}", but didn't see a problem. Also using "else static if" worked alright.

Maybe this has been fixed with the latest release, but I suspect this might have to do with some analysis taking too long, that isn't done when using regular "if" only.

Could you please check again and try to reduce the code to a amaller size or attach the full example? Thanks.

--
December 06
https://issues.dlang.org/show_bug.cgi?id=19411

--- Comment #2 from John Chapman <johnch_atms@hotmail.com> ---
Created attachment 1719
  --> https://issues.dlang.org/attachment.cgi?id=1719&action=edit
Code to repro issue 19411

--
December 06
https://issues.dlang.org/show_bug.cgi?id=19411

--- Comment #3 from John Chapman <johnch_atms@hotmail.com> ---
I tried again with version 0.48.0 and it still happens. In fact it's now occuring with regular "if"s as well. I've attached code that triggers this.

I checked my error logs and whenever this happens DParserCOMServer.exe appears with exception code 0xc00000fd - System.StackOverflowException.

--
December 07
https://issues.dlang.org/show_bug.cgi?id=19411

--- Comment #4 from Rainer Schuetze <r.sagitario@gmx.de> ---
Thanks. It's a builtin limitation of the recursive descend parser because the if/else-series creates a deep tree of AST nodes. Even if optimized in the parser the same problem will appear during analysis.

I will increase the stack size to 8 MB, similar to dmd. dmd also chokes at some point, e.g.

module mod;

string genIfElse(int n)
{
        string s = "if(size_t.sizeof == 4) {}\n";
        foreach(i; 0..n)
                s ~= "else if(size_t.sizeof == 4) {}";
        return s;
}
void test()
{
        mixin(genIfElse(5000));
}

--