[Issue 11271] New: [REG 2.063] auto ref opAssign + destructor + struct literal fails

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 15 02:36:18 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11271

           Summary: [REG 2.063] auto ref opAssign + destructor + struct
                    literal fails
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: code at benjamin-thaut.de


--- Comment #0 from Benjamin Thaut <code at benjamin-thaut.de> 2013-10-15 02:36:15 PDT ---
The following code used to work fine up to dmd 2.062. 

Error message of dmd 2.063.2 and dmd 2.064 beta 1:
repro.d(16): Error: template repro.SmartPtr!(Object).SmartPtr.opAssign(U)(auto
ref U rh) cannot deduce template function
 from argument types !()(SmartPtr!(Object))

Error message of dmd 2.064 git head:

repro.d(16): Error: template repro.SmartPtr!(Object).SmartPtr.opAssign does not
match any function template declaration.
 Candidates are:
repro.d(8):        repro.SmartPtr!(Object).SmartPtr.opAssign(U)(auto ref U rh)
repro.d(16): Error: template repro.SmartPtr!(Object).SmartPtr.opAssign(U)(auto
ref U rh) cannot deduce template function
 from argument types !()(SmartPtr!(Object))

Repro case:

struct SmartPtr(T)
{   
  ~this()
  {
  }

  // BUG: adding "auto ref" to U will fail compilation
  void opAssign(U)(auto ref U rh)
  {
  }
}

void main(string[] args)
{
  SmartPtr!Object a;
  a = SmartPtr!Object();
}

-- 
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