[Issue 23676] Compilation differences w/ braceless vs brace-full static if within switch statement
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 10 12:05:54 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23676
--- Comment #4 from RazvanN <razvan.nitu1305 at 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.
--
More information about the Digitalmars-d-bugs
mailing list