www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10745] New: Incomplete and misleading error message: opOpAssign isn't a template

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

           Summary: Incomplete and misleading error message: opOpAssign
                    isn't a template
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: alanb ucora.com


--- Comment #0 from Rob T <alanb ucora.com> 2013-08-02 13:55:50 PDT ---
Forgetting to build the opOPAssign template correctly results in a confusing
error away from where it actually is.

Example in module A:

500 struct item
501 {
502 
503    opOpAssign( int x ) { ... }
504 
505 }

Meanwhile, somewhere in another module B:

1000   item i;
1001   i ~= 5; 

Error (1001): i.opOpAssign isn't a template.

OK, so opOpAssign is not a template, but that explains almost nothing and
supplies few clues as to where the error really is and how to make a
correction.

The error message can be improved considerably by stating the type involved, eg
"item" and the offending module and line of code eg, module A, line 503, along
with a meaningful hint stating what the opOpAssign signature should look like,
eg opOPAssign(string op)(T value) or if it can be deduced from line 1000
opOPAssign("~")( int x ) which would be even better.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 02 2013