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

[REG2.063a] Issue 10047 - opDispatch instantiation failure should be gagged for UFCS #1981

Merged
merged 1 commit into from May 14, 2013
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
7 changes: 6 additions & 1 deletion src/mtype.c
Expand Up @@ -2044,7 +2044,12 @@ Expression *Type::noMember(Scope *sc, Expression *e, Identifier *ident, int flag
tiargs->push(se);
DotTemplateInstanceExp *dti = new DotTemplateInstanceExp(e->loc, e, Id::opDispatch, tiargs);
dti->ti->tempdecl = td;
return dti->semanticY(sc, flag);

unsigned errors = flag ? global.startGagging() : 0;
Expression *e = dti->semanticY(sc, 0);
if (flag && global.endGagging(errors))
e = NULL;
return e;
}

/* See if we should forward to the alias this.
Expand Down
21 changes: 21 additions & 0 deletions test/runnable/ufcs.d
Expand Up @@ -704,6 +704,26 @@ void test10041()
assert(writeln10041(aa) == "int[int]");
}

/*******************************************/
// 10047

struct Typedef10047(T)
{
template opDispatch(string name)
{
static assert(0);
}
}

struct A10047 {}
int foo10047(Typedef10047!A10047 a) { return 10; }

void test10047()
{
Typedef10047!A10047 a;
assert(a.foo10047() == 10);
}

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

int main()
Expand All @@ -730,6 +750,7 @@ int main()
test9946();
test10003();
test10041();
test10047();

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