Skip to content

Commit

Permalink
fix Issue 14656 - "auto" of "auto ref" spills over to other function
Browse files Browse the repository at this point in the history
  • Loading branch information
Kozzi11 committed Jun 8, 2015
1 parent df5a047 commit ee8edc2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,8 @@ Type *stripDefaultArgs(Type *t)
for (size_t j = 0; j < params->dim; j++)
(*params)[j] = (*parameters)[j];
}
(*params)[i] = new Parameter(p->storageClass, ta, NULL, NULL);
StorageClass stc = p->storageClass & (~STCauto); // issue 14656
(*params)[i] = new Parameter(stc, ta, NULL, NULL);
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions test/runnable/functype.d
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,26 @@ void test10734()

}

void test14656()
{
void unaryFun()(auto int a) pure nothrow @safe @nogc {}
alias Identity(F) = F;
unaryFun!()(41);
static void fun(int n) pure nothrow @safe @nogc {}
alias F = typeof(fun);
assert(Identity!F.stringof == "pure nothrow @nogc @safe void(int)");
}

void test14656_ref()
{
void unaryFun()(auto ref int a) pure nothrow @safe @nogc {}
alias Identity(F) = F;
unaryFun!()(41);
static void fun(int n) pure nothrow @safe @nogc {}
alias F = typeof(fun);
assert(Identity!F.stringof == "pure nothrow @nogc @safe void(int)");
}

/***************************************************/

int main()
Expand All @@ -309,6 +329,8 @@ int main()
test3866();
test8579();
test14210();
test14656();
test14656_ref();

printf("Success\n");
return 0;
Expand Down

0 comments on commit ee8edc2

Please sign in to comment.