www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21107] New: Cannot define an r/w property inside a function

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

          Issue ID: 21107
           Summary: Cannot define an r/w property inside a function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: porton narod.ru

It wonders me that the following program does not compile:

void main() {
   property int x() { return 0; }
   property void x(int) { }
}

x.d(3): Error: declaration x is already defined

Is it a DMD v2.090.1 bug?

If it should not be compilable indeed, it is nevertheless a bug: The error
message should be more clear.

--
Aug 03 2020