www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4749] New: Templated & non-templated constructors conflicting

reply d-bugmail puremagic.com writes:
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



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: -------
Aug 28 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4749




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: -------
Aug 28 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4749




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: -------
Aug 28 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4749


Brad Roberts <braddr puremagic.com> changed:

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



---
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: -------
Feb 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4749


simendsjo <simendsjo gmail.com> changed:

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



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: -------
Aug 02 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jul 20 2013