www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 435] New: Constructors should be templatized

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435

           Summary: Constructors should be templatized
           Product: D
           Version: 0.169
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: aarti interia.pl


It is  not possible to make constructors as template functions. As constructor
does not differ so much from function it should not be very difficult to
implement it, but gives lot more flexibility.


-- 
Oct 15 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei metalanguage.com




--- Comment #1 from Andrei Alexandrescu <andrei metalanguage.com>  2009-05-18
12:31:07 PDT ---
A quick unittest:

class B
{
    this(int) {}
}

class D : B
{
    this(A...)(A args) { super(args); }
}

unittest
{
    auto a = new D(4);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435


Steven Schveighoffer <schveiguy yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reiner.pope gmail.com


--- Comment #2 from Steven Schveighoffer <schveiguy yahoo.com> 2010-08-05
10:57:21 PDT ---
*** Issue 1462 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 05 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ivan.melnychuk+d gmail.com


--- Comment #3 from nfxjfg gmail.com 2010-09-21 04:59:11 PDT ---
*** Issue 4905 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 21 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435



--- Comment #4 from Shin Fujishiro <rsinfu gmail.com> 2010-10-25 11:39:57 PDT
---
Created an attachment (id=794)
Patch against dmd trunk r727, for D2

This is a D2 enhancement patch.  Passed dmd/druntime/phobos tests and testcases
in the reports.

class.c:  Just added isTemplateDeclaration() to an if condition.  It makes the
ClassDeclaration recognize constructor templates as its constructors.

expression.c:  Changed toParent() to isThis().  toParent() doesn't check
through template instances and misunderstands that constructor is not declared
inside a class or struct.  isThis() (or toParent2) takes care of such cases.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 25 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435



--- Comment #5 from sweatygarlic yahoo.co.jp 2011-05-15 09:57:25 PDT ---
Created an attachment (id=973)
this is a modification to initialize const member

this contains the diff of `794: Patch against dmd trunk r727, for D2'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 15 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435


Mathias Baumann <mathias.baumann sociomantic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mathias.baumann sociomantic
                   |                            |.com


--- Comment #6 from Mathias Baumann <mathias.baumann sociomantic.com>
2011-10-03 04:59:29 PDT ---
This fix seems to have not made it to dmd v1.071

Could D1 also be fixed, please?

 --Marenz

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 03 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joshuareusch web.de


--- Comment #7 from kennytm gmail.com 2012-02-09 14:07:28 PST ---
*** Issue 4531 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 09 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |kennytm gmail.com


--- Comment #8 from kennytm gmail.com 2012-02-09 14:42:55 PST ---
Pull #703 (which is the same as patch 794 here).

https://github.com/D-Programming-Language/dmd/pull/703

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 09 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435



--- Comment #9 from github-bugzilla puremagic.com 2012-02-18 23:48:03 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/18e6ecf0e3680fff13ac77f3a4d6de5a459a9ca6
Merge pull request #703 from kennytm/bug435_template_ctor

Bug 435: Constructors should be templatized

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=435


Walter Bright <bugzilla digitalmars.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: -------
Feb 19 2012