[Issue 21107] New: Cannot define an r/w property inside a function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 4 03:09:29 UTC 2020


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 at puremagic.com
          Reporter: porton at 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.

--


More information about the Digitalmars-d-bugs mailing list