[Issue 17752] New: Switch skips over declaration issued for explicitly uninitialized variables

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Aug 13 09:50:57 PDT 2017


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 at puremagic.com
          Reporter: mathias.lang at 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.

--


More information about the Digitalmars-d-bugs mailing list