Skip to content

Commit

Permalink
fix Issue 12524 - wrong type with inout const arg and inout return
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Apr 15, 2014
1 parent 658bcc7 commit 31a86ed
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mtype.c
Expand Up @@ -1935,7 +1935,12 @@ unsigned char Type::deduceWild(Type *t, bool isRef)
if (isImmutable())
return MODimmutable;
else if (isWildConst())
return MODwildconst;
{
if (t->isWildConst())
return MODwild;
else
return MODwildconst;
}
else if (isWild())
return MODwild;
else if (isConst())
Expand Down
17 changes: 17 additions & 0 deletions test/runnable/testconst.d
Expand Up @@ -2770,6 +2770,23 @@ void validate12089(S)(in S str)
void decodeImpl12089(S)(auto ref S str)
{}

/************************************/
// 12524

inout(int) dup12524(inout(const(int)) val)
{
return val;
}

void test12524(inout(int))
{
inout(const(int)) val;

auto bug = dup12524(val);

static assert(is(typeof(bug) == inout(int)));
}

/************************************/
// 6941

Expand Down

0 comments on commit 31a86ed

Please sign in to comment.