[Issue 3474] PATCH: Implement opDollar for struct and class indexing operations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 22 00:31:54 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=3474



--- Comment #12 from Don <clugdbug at yahoo.com.au> 2011-11-22 00:30:59 PST ---
(In reply to comment #11)
> With the recent patch this doesn't compile, is this expected?
> 
> 
> struct Foo {
>     int x;
>     alias x opDollar;
>     int opIndex(int k) { return x * k; }
> }
> void main() {
>     Foo f = Foo(7);
>     int x = f[$ - 5]; // Error: undefined identifier __dollar
>     assert(x == 2 * 7);
> }

Yes, it checks that opDollar is either a function or a template function.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list