https://issues.dlang.org/show_bug.cgi?id=17426

Vladimir Panteleev <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |WONTFIX

--- Comment #1 from Vladimir Panteleev <[email protected]> ---
The rule being followed here is:

{
version(x):
...code...
}

is equivalent to

{
version(x)
{...code...}
}

i.e. everything is wrapped until the end of the current scope, or file if at
the top level.

Thus, your code is equivalent to:

version(none)
{
  unittest {assert(false);}
  version(all)
  {
    unittest {assert(false);} // not compiled
    version(none)
    {
      unittest {assert(false);}
    }
  }
}

Making your code work as intuitively expected would mean breaking consistency
with the rule (though adding a warning for this to either DMD or DScanner might
not be a bad idea).

--

Reply via email to