Thread overview
[Issue 4749] New: Templated & non-templated constructors conflicting
Aug 29, 2010
Mitch Hayenga
Aug 29, 2010
Mitch Hayenga
Aug 29, 2010
Mitch Hayenga
Feb 06, 2011
Brad Roberts
Aug 02, 2011
simendsjo
Jul 21, 2013
Jonathan M Davis
August 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4749

           Summary: Templated & non-templated constructors conflicting
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: mitch.hayenga@gmail.com


--- Comment #0 from Mitch Hayenga <mitch.hayenga@gmail.com> 2010-08-28 21:52:39 PDT ---
I don't have a D compiler on me at the moment, but this came up earlier today. Heres a simplified case.

// This breaks due to the constructors (template error message from DMD)
struct A {
  Variant v;
  string s;

  this(T)(T val, string str) {
    v = Variant(val);
    str = s;
  }

  this(int val) {
    v = val;
  }
}

// This works
struct A {
  Variant v;
  string s;

  this(T)(T val, string str) {
    v = Variant(val);
    str = s;
  }

  this(T)(int val) {  // Useless template parameter
    v = val;
  }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4749



--- Comment #1 from Mitch Hayenga <mitch.hayenga@gmail.com> 2010-08-28 21:59:26 PDT ---
Btw, oops bugs in that code.  Swapped s & str in the assignment.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4749



--- Comment #2 from Mitch Hayenga <mitch.hayenga@gmail.com> 2010-08-28 22:08:43 PDT ---
Also likely the same bug as 2972.

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


Brad Roberts <braddr@puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|x86_64                      |x86


--- Comment #3 from Brad Roberts <braddr@puremagic.com> 2011-02-06 15:40:09 PST ---
Mass migration of bugs marked as x86-64 to just x86.  The platform run on isn't what's relevant, it's if the app is a 32 or 64 bit app.

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


simendsjo <simendsjo@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simendsjo@gmail.com


--- Comment #4 from simendsjo <simendsjo@gmail.com> 2011-08-02 06:46:56 PDT ---
A smaller test case:

struct S {
    this()(int v) {}
    this(char[] v) {}
}

t.d(3): Error: constructor t.S.this conflicts with template t.S.__ctor() at
t.d(
2)

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


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jmdavisProg@gmx.com
         Resolution|                            |DUPLICATE


--- Comment #5 from Jonathan M Davis <jmdavisProg@gmx.com> 2013-07-20 21:58:59 PDT ---
*** This issue has been marked as a duplicate of issue 1528 ***

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