D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17518 - [Reg 2.063] confusing error message with inout constructor/ctor
Summary: [Reg 2.063] confusing error message with inout constructor/ctor
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2017-06-17 18:21 UTC by Martin Nowak
Modified: 2018-12-21 02:10 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2017-06-17 18:21:21 UTC
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.
Comment 1 Vladimir Panteleev 2017-06-18 07:59:38 UTC
This seems to be a regression.

2.061:

test.d(13): Error: constructor test.S.this (inout(Correct) _param_0) inout is not callable using argument types (Wrong)
test.d(13): Error: cannot implicitly convert expression (Wrong()) of type Wrong to Correct

2.062:

test.d(13): Error: inout method test.S.this is not callable using a mutable object
test.d(13): Error: cannot implicitly convert expression (Wrong()) of type Wrong to Correct

2.063:

test.d(13): Error: inout method test.S.this is not callable using a mutable object

The 2.062 -> 2.063 change was caused by https://github.com/dlang/dmd/pull/1842. Not sure about the first one.
Comment 2 RazvanN 2018-12-18 14:40:59 UTC
PR: https://github.com/dlang/dmd/pull/9102
Comment 3 github-bugzilla 2018-12-21 02:10:18 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/3d9550ca39f53dcdab98093aa77221a1b8b30538
Fix Issue 17518 - [Reg 2.063] confusing error message with inout constructor/ctor

https://github.com/dlang/dmd/commit/624236c30ab84957a8f75f5c51fe75b3b2b99e41
Merge pull request #9102 from RazvanN7/Issue_17518

Fix Issue 17518 - [Reg 2.063] confusing error message with inout constructor/ctor
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>