www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18736] New: constructor calls allowed after case labels

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

          Issue ID: 18736
           Summary: constructor calls allowed after case labels
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

Delegating constructor calls are not allowed after labels, but case labels and
default labels should also count as labels.

  class A
  {
    this(char c) { }

    this(int i)
    {
        switch (i)
        {
            case 1:  break;
            default: break;
        }
        this('c'); // should give error
    }
  }

--
Apr 05 2018