Thread overview
mixins and opEquals
Apr 12, 2005
Ben Hinkle
Apr 12, 2005
Regan Heath
Apr 12, 2005
Ben Hinkle
Apr 12, 2005
Thomas Kuehne
April 12, 2005
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
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
"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
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