D.gnu - Template constraint error.
- Gary Willoughby (32/32) Oct 10 2013 Using Debian7, gcc-4.8, gdc-4.8 from the `testing main` debian
- Johannes Pfau (7/9) Oct 10 2013 This syntax was added in a more recent frontend release. You should do
Using Debian7, gcc-4.8, gdc-4.8 from the `testing main` debian source. import std.stdio; class Bar(T) if (is(T == int)) { this() { writefln(T.stringof); } } class Foo(T) : Bar!(int) if (is(T == string)) // <-- template constraint causes error. { this() { super(); writefln(T.stringof); } } void main() { auto baz = new Foo!(string)(); } $ gdc test.d -o test test.d:11: Error: members expected test.d:11: Error: { } expected following aggregate declaration test.d:11: Error: Declaration expected, not 'if' test.d:16: Error: function declaration without return type. (Note that constructors are always named 'this') test.d:16: Error: no identifier for declarator writefln(T.stringof) test.d:17: Error: unrecognized declaration
Oct 10 2013
Am Thu, 10 Oct 2013 16:46:18 +0200 schrieb "Gary Willoughby" <dev nomad.so>:class Foo(T) : Bar!(int) if (is(T == string)) // <-- template constraint causes error.This syntax was added in a more recent frontend release. You should do this instead for older frontend versions: ------- class Foo(T) if (is(T == string)) : Bar!(int) -------
Oct 10 2013