| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
April 12, 2005 mixins and opEquals | ||||
|---|---|---|---|---|
| ||||
I don't know if this has already been reported but here is a short set of reproduction steps for the error happening to MinTL in dmd-120:
template Share(T) {
int opEquals(T x) { return 0; }
}
struct List(T) {
// works
// int opEquals(List x) { return 0; }
// doesn't work
mixin Share!(List);
}
int main() {
List!(int) x;
return 0;
}
gives the compiler error:
C:\d\mintl>dmd bug.d
bug.d(5): function bug.List!(int).List.opEquals (List *) does not match
argument types (List )
bug.d(5): cannot implicitly convert expression (*(p)) of type List to List *
bug.d(15): template instance bug.List!(int) error instantiating
| ||||
April 12, 2005 Re: mixins and opEquals | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | On Mon, 11 Apr 2005 21:28:29 -0400, Ben Hinkle <ben.hinkle@gmail.com> wrote: > I don't know if this has already been reported I think so: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/3213 And then I thought it wasn't a bug, but a limitation: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/20451 Now I think I miss-understood the template limitation thing, and it doesn't apply here. Regan > but here is a short set of > reproduction steps for the error happening to MinTL in dmd-120: > > template Share(T) { > int opEquals(T x) { return 0; } > } > > struct List(T) { > > // works > // int opEquals(List x) { return 0; } > > // doesn't work > mixin Share!(List); > } > > int main() { > List!(int) x; > return 0; > } > > gives the compiler error: > C:\d\mintl>dmd bug.d > bug.d(5): function bug.List!(int).List.opEquals (List *) does not match > argument types (List ) > bug.d(5): cannot implicitly convert expression (*(p)) of type List to List * > bug.d(15): template instance bug.List!(int) error instantiating > > | |||
April 12, 2005 Re: mixins and opEquals | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | "Regan Heath" <regan@netwin.co.nz> wrote in message news:opso3jphje23k2f5@nrage.netwin.co.nz... > On Mon, 11 Apr 2005 21:28:29 -0400, Ben Hinkle <ben.hinkle@gmail.com> wrote: >> I don't know if this has already been reported > > I think so: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/3213 > > And then I thought it wasn't a bug, but a limitation: http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/20451 > > Now I think I miss-understood the template limitation thing, and it doesn't apply here. I think they are differnent issues. The code I posted worked fine in 119. The links talk about non-static members to classes and I'm adding it to a struct and I'm mixing it in. | |||
April 12, 2005 Re: mixins and opEquals | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle Attachments: | Ben Hinkle wrote: > I don't know if this has already been reported but here is a short set of reproduction steps for the error happening to MinTL in dmd-120: > > template Share(T) { > int opEquals(T x) { return 0; } > } > > struct List(T) { > > // works > // int opEquals(List x) { return 0; } > > // doesn't work > mixin Share!(List); > } > > int main() { > List!(int) x; > return 0; > } > > gives the compiler error: > C:\d\mintl>dmd bug.d > bug.d(5): function bug.List!(int).List.opEquals (List *) does not match > argument types (List ) > bug.d(5): cannot implicitly convert expression (*(p)) of type List to List > * bug.d(15): template instance bug.List!(int) error instantiating Added to DStress as http://dstress.kuehne.cn/run/mixin_11.d Thomas | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply