www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10982] New: Misleading diagnostic for missing member function overload: "Error: inout method ... is not callable using a const object"

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10982

           Summary: Misleading diagnostic for missing member function
                    overload: "Error: inout method ... is not callable
                    using a const object"
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: acehreli yahoo.com


--- Comment #0 from Ali Cehreli <acehreli yahoo.com> 2013-09-06 15:21:19 PDT ---
The following struct has two functions, one marked as const and the other
marked as inout. Note that both calls in main are in error: they lack an
argument.

struct S
{
    void is_const(int) const
    {}

    void is_inout(int) inout
    {}
}

void main()
{
    const s = S();
    s.is_const();
    s.is_inout();
}

The error message for the first one is correct because it mentions the
mismatched argument list:

  Error: function deneme.S.is_const (int _param_0) const is not callable using
argument types () const

However, the error message for the second call is misleading:

  Error: inout method deneme.S.is_inout is not callable using a const object

Ali

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 06 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10982


Denis Shelomovskij <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg gmail.com
           Severity|normal                      |major


--- Comment #1 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2013-09-23
11:57:19 MSD ---
Very frustrating as `inout` is not an obvious language feature (I mean all
these implicit conversions) and the error will misguide lots of coders.

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