On Thursday, 17 May 2018 at 20:32:23 UTC, Steven Schveighoffer
wrote:
On 5/17/18 4:25 PM, DarkHole wrote:
On Thursday, 17 May 2018 at 20:02:19 UTC, Steven Schveighoffer
wrote:
On 5/17/18 3:55 PM, DarkHole wrote:
This strange code - https://run.dlang.io/is/BKgv49 - fails
with error "Error: constructor calls not allowed in loops or
after labels", but there is no loops or labels.
Switch cases are labels.
But why?
You mean why is it an error? Probably because the compiler
needs to guarantee you are calling the super constructor, and
it can't figure out the flow when it sees labels/loops. Not
that it's always impossible, but it's likely a complication the
compiler devs don't want to deal with.
-Steve
Why isn't the compiler doing proper flow analysis? Is it that
just no one bothered to implement it?