Thread overview
[Issue 7150] New: Templated Constructors Should be Able to Call Other Constructors
Dec 22, 2011
Andrew Wiley
Dec 22, 2011
Kenji Hara
Jul 23, 2012
Kenji Hara
December 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7150

           Summary: Templated Constructors Should be Able to Call Other
                    Constructors
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: debio264@gmail.com


--- Comment #0 from Andrew Wiley <debio264@gmail.com> 2011-12-21 23:18:00 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 22, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7150


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-12-22 00:28:19 PST ---
https://github.com/D-Programming-Language/dmd/pull/574

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7150



--- Comment #2 from github-bugzilla@puremagic.com 2012-07-22 18:03:48 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7150


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------