www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16201] New: When all paths inside a static if return/throw,

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

          Issue ID: 16201
           Summary: When all paths inside a static if return/throw, the
                    portion after static if should be as if "else" were
                    used
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andrei erdani.com

Consider:

static if (condition)
{
   ... code 1 ...
   return;
}
... code 2 ...

This should be treated by the compiler the same as:

static if (condition)
{
   ... code 1 ...
   return;
}
else
{
    ... code 2 ...
}

Currently it gets quite annoying to have to nest multiple static ifs and elses.

--
Jun 24 2016