[Issue 8395] New: Templated struct constructors don't implicitly convert to const

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 16 23:45:38 PDT 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 at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at 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: -------


More information about the Digitalmars-d-bugs mailing list