www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17752] New: Switch skips over declaration issued for

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

          Issue ID: 17752
           Summary: Switch skips over declaration issued for explicitly
                    uninitialized variables
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: mathias.lang sociomantic.com

Currently the "switch skips over declaration of variable blahblah" deprecation
message is issued even if the initialization is not done on purpose.
For example the following code should compile without deprecation:

```
void main (string[] args)
{
    switch (args.length)
    {
        int x = void;
    default:
        break;
    }
}
```

On a related note, the warning should say "initialization" instead of
declaration, as the stack address for the variable still exists.

--
Aug 13 2017