July 18, 2004 mixin identifier and operator syntax | ||||
---|---|---|---|---|
| ||||
This crashes on DMD 0.95 XP SP1. The issue is the use of [] syntax to invoke opIndex. module test; template Test() { bit opIndex(bit x) { return !x; } } void main() { mixin Test!() xs; bit x = xs[false]; } I'm not sure if it is allowed, but I don't see why not. |
July 20, 2004 Re: mixin identifier and operator syntax | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bent Rasmussen | It shouldn't be allowed, since operator overloading is for structs and classes. "Bent Rasmussen" <exo@bent-rasmussen.info> wrote in message news:cdcrm9$1u85$1@digitaldaemon.com... > This crashes on DMD 0.95 XP SP1. The issue is the use of [] syntax to invoke > opIndex. > > module test; > > template Test() > { > bit opIndex(bit x) > { > return !x; > } > } > > void main() > { > mixin Test!() xs; > bit x = xs[false]; > } > > I'm not sure if it is allowed, but I don't see why not. > > |
Copyright © 1999-2021 by the D Language Foundation