Thread overview
[Issue 8395] New: Templated struct constructors don't implicitly convert to const
Jul 17, 2012
Don
Jul 20, 2012
Kenji Hara
Aug 18, 2012
Kenji Hara
July 17, 2012
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


--- Comment #0 from Don <clugdbug@yahoo.com.au> 2012-07-16 23:45:37 PDT ---
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: -------
July 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8395


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

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


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-07-20 10:46:53 PDT ---
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: -------
July 23, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8395



--- Comment #2 from github-bugzilla@puremagic.com 2012-07-23 01:39:06 PDT ---
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 Merge pull request #1060 from 9rnsr/fix8395

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: -------
August 18, 2012
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: -------