Skip to content

Commit

Permalink
fix Issue 16572 - can't take inout delegate
Browse files Browse the repository at this point in the history
- fix error to account for inout (MODwild) matches
  • Loading branch information
MartinNowak committed Oct 14, 2016
1 parent 7ddb346 commit 847baa9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/expression.d
Original file line number Diff line number Diff line change
Expand Up @@ -9408,7 +9408,7 @@ extern (C++) final class DelegateExp : UnaExp
if (f.type.ty == Tfunction)
{
TypeFunction tf = cast(TypeFunction)f.type;
if (!MODimplicitConv(e1.type.mod, f.type.mod))
if (!MODmethodConv(e1.type.mod, f.type.mod))
{
OutBuffer thisBuf, funcBuf;
MODMatchToBuffer(&thisBuf, e1.type.mod, tf.mod);
Expand Down
15 changes: 15 additions & 0 deletions test/compilable/test16572.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class K
{
inout(int) f() inout
{
return var;
}

void bug()
{
auto d = &f;
d();
}

int var;
}

1 comment on commit 847baa9

@TurkeyMan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was easy! :)

Please sign in to comment.