Bug 10745 – Incomplete and misleading error message: opOpAssign isn't a template

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-02T13:55:50Z
Last change time
2024-12-13T18:09:58Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Rob T
Moved to GitHub: dmd#18640 →

Comments

Comment #0 by alanb — 2013-08-02T13:55:50Z
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.
Comment #1 by robert.schadek — 2024-12-13T18:09:58Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18640 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB