D-Programming-Language/dmd — pull request #1516 by AndrejMitrovic (2013-01-20 05:48:37+00:00)
Title: Issue 5969 - Diagnostic on wrong foreach expression should be in front-end.

http://d.puremagic.com/issues/show_bug.cgi?id=5969

I'm not a fan of the double error message, so if this is a problem I could change `inferAggregate` to return an `ErrorExp` to avoid it (or use some other solution).

I found the `.tupleof` creation code was copy-pasted and used in two places with the only difference being an extra check (`if (v->isThisDeclaration()) continue`) in one of the snippets. I can't tell whether this was intentional or buggy code as a result of copy-pasting instead of factoring the tuple creation into a function. I've created a `makeTupleOf` function which has the check inside and removed copy-pasted code.