www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13326] New: Specification of CaseStatement doesn't fit empty

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

          Issue ID: 13326
           Summary: Specification of CaseStatement doesn't fit empty case
                    body
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P1
         Component: websites
          Assignee: nobody puremagic.com
          Reporter: s.trump gmail.com
            Blocks: 10233

Lets parse next D code:

 switch(n) {
 case 1:
 case 2:
   return true;
 }
This is a valid D language construction. But documentation says that statement "case 1:" must be followed by any statement except other "case" or "default". As documentation says (http://dlang.org/statement#CaseStatement) "case ArgumentList :" is followed by "ScopeStatementList" (http://dlang.org/statement#ScopeStatementList) which is a list of any statements except CaseStatement or CaseRangeStatement or DefaultStatement. This rule conflicts with actual D language compiler. --
Aug 18 2014