May 16, 2013 template specialization and template mixin | ||||
|---|---|---|---|---|
| ||||
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 Re: template specialization and template mixin | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jack Applegame | On 5/16/13, Jack Applegame <japplegame@gmail.com> wrote:
> Why this doesn't compile?
I think this is a bug.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply