[Issue 7150] New: Templated Constructors Should be Able to Call Other Constructors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 21 23:18:02 PST 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 at puremagic.com
        ReportedBy: debio264 at gmail.com


--- Comment #0 from Andrew Wiley <debio264 at 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: -------


More information about the Digitalmars-d-bugs mailing list