Bug 6492 – properties of alias this'd array overrides method

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-08-14T09:35:00Z
Last change time
2011-10-23T07:15:24Z
Keywords
rejects-valid
Assigned to
nobody
Creator
hoganmeier

Comments

Comment #0 by hoganmeier — 2011-08-14T09:35:08Z
import std.stdio; struct F { int[] g; alias g this; auto ptr() { return g.ptr; write("ptr\n"); } } void main() { F a; auto p = a.ptr; } prints nothing even though ptr method should override g's .ptr
Comment #1 by k.hara.pg — 2011-10-23T02:32:51Z
This is sample-code bug. import std.stdio; struct F { int[] g; alias g this; auto ptr() { write("ptr\n"); // print before return return g.ptr; } } void main() { F a; auto p = a.ptr; }
Comment #2 by hoganmeier — 2011-10-23T07:07:04Z
How embarrassing.
Comment #3 by k.hara.pg — 2011-10-23T07:15:24Z
Never mind!