Bug 7150 – Templated Constructors Should be Able to Call Other Constructors

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-12-21T23:18:00Z
Last change time
2012-07-22T18:04:05Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
debio264

Comments

Comment #0 by debio264 — 2011-12-21T23:18:00Z
Template constructors currently cannot call other constructors in an aggregate type: --- 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 } --- Template constructors should follow the same rules for constructors-calling-constructors as normal non-template constructors.
Comment #1 by k.hara.pg — 2011-12-22T00:28:19Z
Comment #2 by github-bugzilla — 2012-07-22T18:03:48Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4d85f11ba5f37664e1803e0126a6402d70c1ac1d fix Issue 7150 - Templated Constructors Should be Able to Call Other Constructors bug 7150 was already fixed in commit 59c5fe5f6a, so this is just adding test case. https://github.com/D-Programming-Language/dmd/commit/66e5887e8c63935575e460add5e9ff0c142a1b81 Merge pull request #574 from 9rnsr/fix7150 [test only] Issue 7150 - Templated Constructors Should be Able to Call Other Constructors