[Issue 1399] Wrapping a case statement in a version statement gives a shadowing declaration error.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 12 10:24:25 UTC 2019


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |INVALID

--- Comment #7 from RazvanN <razvan.nitu1305 at gmail.com> ---
This the correct behavior. The compiler identifies the end of a case statement
if it has encountered another case/default statement or the ending `}` of the
switch statement. Once a version identifier or even a static if is encountered,
the parser sees it as part of the case statement that it is analyzing at that
time.

A workaround would be to add the version block in the default statement and
lose the `case 2` statement.

Closing as invalid.

--


More information about the Digitalmars-d-bugs mailing list