digitalmars.D - Templated Struct Constructors
- Andrew Wiley (15/15) Dec 21 2011 Is this a bug, or are templated struct constructors not allowed to
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
}
---
Dec 21 2011








Andrew Wiley <wiley.andrew.j gmail.com>