Skip to content

Commit

Permalink
fix Issue 678 - Compiler accepts, for a function T[] t(), t().ptr but…
Browse files Browse the repository at this point in the history
… not t.ptr
  • Loading branch information
WalterBright committed Jan 21, 2012
1 parent e3ff6bd commit 1d2c121
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions property.dd
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,24 @@ $(V2
$(P The built in properties $(CODE .sizeof), $(CODE .alignof), and $(CODE .mangleof)
may not be declared as fields or methods in structs, unions, classes or enums.
)

$(P If a .property is applied to a user-defined property, the .property is applied
to the result of the function call.
)

$(V2
---
void main() {
@property int[] delegate() bar1 = { return [1, 2]; };
auto x1 = bar1.ptr; // points to array data

struct Foo { int* ptr; }
@property Foo delegate() bar2 = { return Foo(); };
auto x2 = bar2.ptr; // gets value of Foo.ptr
}
---
)

)

)
Expand Down

0 comments on commit 1d2c121

Please sign in to comment.