Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 8943 - Cannot get parent of an overload #1251

Merged
merged 1 commit into from Nov 8, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/traits.c
Expand Up @@ -213,7 +213,11 @@ Expression *TraitsExp::semantic(Scope *sc)
Object *o = (*args)[0];
Dsymbol *s = getDsymbol(o);
if (s)
{
if (FuncDeclaration *fd = s->isFuncDeclaration()) // Bugzilla 8943
s = fd->toAliasFunc();
s = s->toParent();
}
if (!s)
{
error("argument %s has no parent", o->toChars());
Expand Down
16 changes: 16 additions & 0 deletions test/runnable/overload.d
Expand Up @@ -79,12 +79,28 @@ void test7552()
FooInU[1]("");
}

/***************************************************/
// 8943

void test8943()
{
struct S
{
void foo();
}

alias TypeTuple!(__traits(getOverloads, S, "foo")) Overloads;
alias TypeTuple!(__traits(parent, Overloads[0])) P; // fail
static assert(is(P[0] == S));
}

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

int main()
{
test7418();
test7552();
test8943();

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