Report invalid clauses with FOREACH

Before semantic checking the clauses themselves
Merge pull request #2059 from cleishm/foreach-clause-check

Report invalid clauses with FOREACH