www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17518] New: confusing error message with inout constructor/ctor

https://issues.dlang.org/show_bug.cgi?id=17518

          Issue ID: 17518
           Summary: confusing error message with inout constructor/ctor
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

cat > bug.d << CODE
struct S
{
    this(inout Correct) inout
    {
    }
}

struct Correct {}
struct Wrong {}

S bug()
{
    return S(Wrong());
}
CODE
dmd -c bug
----
bug.d(13): Error: inout method bug.S.this is not callable using a mutable
object
----

The error should point out that the wrong type is passed, not that it's
mutable.

--
Jun 17