www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - template specialization and template mixin

reply "Jack Applegame" <japplegame gmail.com> writes:
This code compiles , as expected
     struct A {
       void func(string s : "foo")() {
         pragma(msg, "func for foo");
       }
       void func(string s)() {
         pragma(msg, "func for others: " ~ s);
       }
     }

     void main() {
       A a;
       a.func!"foo"();
       a.func!"bar"();
     }
Why this doesn't compile?
     mixin template M() {
       void func(string s)() {
         pragma(msg, "func for others: " ~ s);
       }
     }

     struct A {
       mixin M;
       void func(string s : "foo")() {
         pragma(msg, "func for foo");
       }
     }

     void main() {
       A a;
       a.func!"foo"();
       a.func!"bar"(); // Error
     }
May 16 2013
parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 5/16/13, Jack Applegame <japplegame gmail.com> wrote:
 Why this doesn't compile?
I think this is a bug.
May 16 2013