[Issue 11529] New: Unclear error message when rvalue is passed `ref`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 16 10:17:53 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11529

           Summary: Unclear error message when rvalue is passed `ref`
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: rscrihf at gmail.com


--- Comment #0 from Roy Crihfield <rscrihf at gmail.com> 2013-11-16 10:17:52 PST ---
Compiling this:

  struct S {}
  void f(ref S s) {}

  void main()
  {
    f(S());
  }

Gives an error without a clear explanation: 

  Error: function f730.f (ref S s) is not callable using argument types (S)

This should at the very least give an indication that the struct passed is a
temporary. Especially for those unfamiliar with the language, there's no
obvious indication of a type mismatch. 

The same issue applies to `const ref' and `in ref' parameters.

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


More information about the Digitalmars-d-bugs mailing list