www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24383] New: Index assignment expression in __traits(compiles)

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

          Issue ID: 24383
           Summary: Index assignment expression in __traits(compiles)
                    fails to parse
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of DMD 2.107.0, the following program fails to compile:

---
enum _ = __traits(compiles, a[0] = 0);
---

The error message is:

---
bug.d(1): Error: found `=` when expecting `)` following template argument list
bug.d(1): Error: semicolon expected following auto declaration, not `0`
bug.d(1): Error: declaration expected, not `0`
---

This is clearly an error in the parser. There is no template in this program,
so it should not be parsing a template argument list.

--
Feb 09