Templated Struct Constructors

kenji hara k.hara.pg at gmail.com
Wed Dec 21 22:32:56 PST 2011


Please file it into bugzilla, because it is a bug.
I'll post a patch to fix it.

Kenji Hara

2011/12/22 Andrew Wiley <wiley.andrew.j at gmail.com>:
> Is this a bug, or are templated struct constructors not allowed to
> call other constructors?
>
> ---
> struct A {
>    this(T)(T thing, int i) {
>        this(thing, i > 0); // Error: constructor call must be in a constructor
>    }
>    this(T)(T thing, bool b) {
>    }
> }
>
> void main() {
>    auto a = A(5, 5); // Error: template instance
> constructtest.A.__ctor!(int) error instantiating
> }
> ---


More information about the Digitalmars-d mailing list