https://issues.dlang.org/show_bug.cgi?id=23676

--- Comment #4 from RazvanN <razvan.nitu1...@gmail.com> ---
I manually reduced it to get rid of phobos and other unrelated features:

module lexer;

enum Type
{
    operatorSlash,
    operatorSlashEqual,
    operatorAnd,
    operatorAndEqual,
    operatorAndAnd,
    operatorQuestion,
    operatorDollar,
    operatorEqual,
    operatorEqualEqual,
    operatorStar,
    operatorStartEqual,
}

struct Lexer
{
    size_t _index;

    @safe:

    void nextOperator()
    {   
        const couldLex = nextVaryingLengthToken();
    }   

    // Complex reading //

    bool nextVaryingLengthToken()
    {   
        alias TokenTypes = __traits(allMembers, Type);

        bool tryLexLongerOperators(alias TokenType)()
        {   
            static foreach(type; TokenTypes)
            {   
                _index++;
                if(tryLexLongerOperators!type)
                    return true;
                return true;
            }   
        }   

        return tryLexLongerOperators!noreturn;
    }   
}

My hunch is that `static foreach` ends up generating too many recursive calls
to  tryLexLongerOperators, but I don't know exactly what causes the hang.

--

Reply via email to