5946 – failing lookup 'this' from function in template

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5946 - failing lookup 'this' from function in template
Summary: failing lookup 'this' from function in template
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
Reported: 2011年05月07日 06:58 UTC by Kenji Hara
Modified: 2015年06月09日 05:15 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Kenji Hara 2011年05月07日 06:58:08 UTC
Following code compile fails with https://github.com/D-Programming-Language/dmd/commit/3fcc2344681ab9d31d1897188f36051c9beb247f
----
template TTest1()
{
 int call(){ return this.g(); }
}
class CTest1
{
 int f() { mixin TTest1!(); return call(); }
 int g() { return 10; }
}
void main()
{
 assert((new CTest1()).f() == 10);
}
----
test.d(3): Error: 'this' is only defined in non-static member functions, not call
test.d(7): Error: mixin test.CTest1.f.TTest1!() error instantiating
----


AltStyle によって変換されたページ (->オリジナル) /