Skip to content

Commit

Permalink
Merge pull request #8086 from WalterBright/fix18661
Browse files Browse the repository at this point in the history
fix Issue 18661 - auto ref and return attribute inference
merged-on-behalf-of: Jacob Carlborg <jacob-carlborg@users.noreply.github.com>
  • Loading branch information
dlang-bot committed Mar 26, 2018
2 parents 25bc021 + 2b9d203 commit e1f2be6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/dmd/statementsem.d
Expand Up @@ -3139,6 +3139,8 @@ else
*/
if (checkReturnEscapeRef(sc, rs.exp, true))
turnOffRef();
else if (!rs.exp.type.constConv(tf.next))
turnOffRef();
}
else
turnOffRef();
Expand Down
11 changes: 11 additions & 0 deletions test/compilable/test17512.d
Expand Up @@ -13,3 +13,14 @@ struct A
}

A a;

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

struct S0(T)
{
int a;
auto ref immutable(int) getA() { return a; }
}

alias B = S0!int;

0 comments on commit e1f2be6

Please sign in to comment.