https://issues.dlang.org/show_bug.cgi?id=15166
Steven Schveighoffer <schvei...@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |schvei...@yahoo.com --- Comment #6 from Steven Schveighoffer <schvei...@yahoo.com> --- (In reply to Martin Nowak from comment #4) > A workaround is to use a variable. I think this may be the right answer. It boils down to this: static if(someCondition) return false; return true; Which you would normally write with else, but it's not so simple in this case, because the "else" would be part of the loop. I'm curious why the return short-circuits the loop. In other words, why aren't all the "return false" statements besides the first one flagged for unreachability? Is it because the compiler stops generating the statements? I mean, if you rewrote as a bunch of static ifs, then wouldn't you have the same problem? Another possible answer is to do this: private bool compare(alias Group1, alias Group2)() { foreach (index, element; Group!(Group1.expand, void).expand) { static if(index == Group1.expand.length) return true; else static if (!is(Group1.expand[index] == Group2.expand[index])) return false; } } --