www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13979] New: ForeachType grammar does not allow 'ref' to

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

          Issue ID: 13979
           Summary: ForeachType grammar does not allow 'ref' to appear
                    after type constructors
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/grammar.html#ForeachType
                OS: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P1
         Component: websites
          Assignee: nobody puremagic.com
          Reporter: briancschott gmail.com
            Blocks: 10233

Example DMD-valid code rejected by language spec:
---
foreach (foo, const ref bar; qwer.tyuiop)
---

The grammar spec says this:

ForeachType:
    'ref'? TypeCtors? BasicType Declarator
    'ref'? TypeCtors? Identifier

Either the compiler should be changed to require that 'ref' appear first, or
the grammar should be corrected to allow 'ref' to appear after type
constructors.

--
Jan 13 2015