www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - mixins and opEquals

reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
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 
Apr 11 2005
next sibling parent reply "Regan Heath" <regan netwin.co.nz> writes:
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
Apr 11 2005
parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"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.
Apr 11 2005
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFCW/Uc3w+/yD4P9tIRAhpxAJ9pSjqq8PNsUcnSCvbD0tFUqdb/PgCeMTr8 VMZyW3acnSl2F7/u7qslO2Y= =2RNv -----END PGP SIGNATURE-----
Apr 12 2005