Skip to content

Commit

Permalink
Merge pull request #4857 from 9rnsr/fix14858
Browse files Browse the repository at this point in the history
Issue 14858 - spurious "Error: overload alias 'foo' is not a variable" when overloading template and non-template via aliases
  • Loading branch information
yebblies committed Sep 15, 2015
2 parents d90837d + 803da8f commit e91a6ac
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 @@ -3791,6 +3791,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 e91a6ac

Please sign in to comment.