Skip to content

Commit

Permalink
fix Issue 14858 - spurious "Error: overload alias 'foo' is not a vari…
Browse files Browse the repository at this point in the history
…able" when overloading template and non-template via aliases
  • Loading branch information
9rnsr committed Aug 31, 2015
1 parent c4539ff commit 803da8f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/expression.d
Original file line number Diff line number Diff line change
Expand Up @@ -3799,6 +3799,12 @@ public:
fd.type = f.type;
return new VarExp(loc, fd, hasOverloads);
}
if (OverDeclaration od = s.isOverDeclaration())
{
e = new VarExp(loc, od, 1);
e.type = Type.tvoid;
return e;
}
if (OverloadSet o = s.isOverloadSet())
{
//printf("'%s' is an overload set\n", o->toChars());
Expand Down
16 changes: 16 additions & 0 deletions test/runnable/overload.d
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,21 @@ void test13783()
assert(f(e) == 10);
}

/***************************************************/
// 14858

int foo14858()() { return 1; }
int bar14858(int) { return 2; }

alias foobar14858 = foo14858;
alias foobar14858 = bar14858;

void test14858()
{
assert(foobar14858() == 1);
assert(foobar14858(1) == 2); // OK <- NG
}

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

int main()
Expand Down Expand Up @@ -1101,6 +1116,7 @@ int main()
test11915();
test11916();
test13783();
test14858();

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

0 comments on commit 803da8f

Please sign in to comment.