www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8395] New: Templated struct constructors don't implicitly convert to const

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

           Summary: Templated struct constructors don't implicitly convert
                    to const
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



struct S
{
  int m;
//  this(long x)   
//  this(T : long)( T x) const
  this(T : long)( T x)
  { m = x;}
}
void main()
{
    S s = 6;
   const S t = 7;
}

bug.d(18): Error: template bug.S.__ctor does not match any function template
declaration
bug.d(11): Error: template bug.S.__ctor(T : long) cannot deduce template
function from argument types !()(int)

If the constructor signature is replaced with either of the two commented
lines, it compiles.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



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

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




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/86cfb07481ce37cb3dc8889597f4652887673f42
fix Issue 8395 - Templated struct constructors don't implicitly convert to
const

With current dmd implementation, non template constructor always ignores the
type qualifier of 'this'. Therefore template constructor should work as like
it.

https://github.com/D-Programming-Language/dmd/commit/29c76d261fe81719addc0219c42b8fccc6562e88


Issue 8395 - Templated struct constructors don't implicitly convert to const

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


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: -------
Aug 18 2012