Navigation Menu

Skip to content

Commit

Permalink
Issue 6738 - Can't call templatized property function from within a s…
Browse files Browse the repository at this point in the history
…truct/class method
  • Loading branch information
9rnsr committed Jan 26, 2012
1 parent 0e7942a commit 1d4438f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/expression.c
Expand Up @@ -2817,7 +2817,11 @@ Expression *DsymbolExp::semantic(Scope *sc)
TemplateDeclaration *td = s->isTemplateDeclaration();
if (td)
{
e = new TemplateExp(loc, td);
Dsymbol *p = td->toParent2();
if (hasThis(sc) && p && p->isAggregateDeclaration())
e = new DotTemplateExp(loc, new ThisExp(loc), td);
else
e = new TemplateExp(loc, td);
e = e->semantic(sc);
return e;
}
Expand Down
20 changes: 20 additions & 0 deletions test/runnable/template9.d
Expand Up @@ -519,6 +519,25 @@ struct T6805
}
static assert(is(T6805.xxx.Type == int));

/**********************************/
// 6738

struct Foo6738
{
int _val = 10;

@property int val()() { return _val; }
int get() { return val; } // fail
}

void test6738()
{
Foo6738 foo;
auto x = foo.val; // ok
assert(x == 10);
assert(foo.get() == 10);
}

/**********************************/
// 6994

Expand Down Expand Up @@ -775,6 +794,7 @@ int main()
test2778get();
test6208a();
test6208b();
test6738();
test6994();
test3467();
test4413();
Expand Down

0 comments on commit 1d4438f

Please sign in to comment.