www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20885] New: pointer rejected for the variable declared in a

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

          Issue ID: 20885
           Summary: pointer rejected for the variable declared in a `if`
                    condition
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

according to the grammar this should be accepted:

---
void main()
{
    alias P  = void*;
    alias PP = void**;
    PP[1] a  = null;
    if (const void** b = a[0]){} // OK
    if (const P*     b = a[0]){} // NG
}
---

but when an identifier is used as BasicType then the
Declarator.VarDeclarator.BasicType2 (i.e the star) is rejected by the parser.

--
May 30