enum Flags : ubyte { Foo = 1, }
void foo() {
if(Flags) { // "Flags" as an expression should yield an error, but is only an error when generating object code, -o- succeeds
}
}
Comment #1 by contact — 2024-05-23T18:30:26Z
From what I investigated, semantics gags the error and defer that to e2ir glue code, hence it doesn't happen on `-o-`.
We have two possible options:
- We do the check for expressions with EXP.error after semantic3 and remove it from e2ir visitor;
- Detect these situations when we encounter them. It seems expressionsem assumes its a forward reference and goes on, which to me, shouldn't.
Comment #2 by contact — 2024-05-23T18:31:24Z
Interesting enough, if you run `-verror=spec` with `-o-` it fails (enables display of error gagging on speculative compilations).
Comment #3 by robert.schadek — 2024-12-13T19:35:18Z