Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Wilson committed Dec 27, 2011
2 parents f7faf00 + 8fa99fc commit 4b7f660
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/template.c
Expand Up @@ -2245,6 +2245,19 @@ MATCH Type::deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters,
else
goto Lnomatch;
}
else if (tparam->ty == Ttypeof)
{
/* Need a loc to go with the semantic routine.
*/
Loc loc;
if (parameters->dim)
{
TemplateParameter *tp = parameters->tdata()[0];
loc = tp->loc;
}

tparam = tparam->semantic(loc, sc);
}

if (ty != tparam->ty)
{
Expand Down
35 changes: 35 additions & 0 deletions test/runnable/template9.d
Expand Up @@ -569,6 +569,39 @@ void test3467()
struct TS6806(size_t n) { pragma(msg, typeof(n)); }
static assert(is(TS6806!(1u) == TS6806!(1)));

/**********************************/
// 4413

struct Foo4413
{
alias typeof(this) typeof_this;
void bar1(typeof_this other) {}
void bar2()(typeof_this other) {}
void bar3(typeof(this) other) {}
void bar4()(typeof(this) other) {}
}

void test4413()
{
Foo4413 f;
f.bar1(f); // OK
f.bar2(f); // OK
f.bar3(f); // OK
f.bar4(f); // ERR
}

/**********************************/
// 5801

int a5801;
void bar5801(T = double)(typeof(a5801) i) {}
void baz5801(T)(typeof(a5801) i, T t) {}
void test5801()
{
bar5801(2); // Does not compile.
baz5801(3, "baz"); // Does not compile.
}

/**********************************/
// 2550

Expand Down Expand Up @@ -694,6 +727,8 @@ int main()
test6208b();
test6994();
test3467();
test4413();
test5801();
test10();
test7037();
test7124();
Expand Down

0 comments on commit 4b7f660

Please sign in to comment.