D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12206 - Can't "alias this" to a template instantiation
Summary: Can't "alias this" to a template instantiation
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-19 15:43 UTC by Vladimir Panteleev
Modified: 2024-12-13 18:17 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vladimir Panteleev 2014-02-19 15:43:46 UTC
template T()
{
	void foo() {}
}

struct S
{
	alias t = T!();
	alias t this;
}

void main()
{
	S s;
	s.foo();
}
Comment 1 Marc Schütz 2015-03-15 16:33:45 UTC
Still there in DMD master. The error message is:

xx.d(15): Error: expression has no value
Comment 2 RazvanN 2018-10-19 14:01:25 UTC
This is a weird case. The alias is part of the struct, but the actual function is not. I would say that the correct behavior is the current one:

Error : no property foo for type S.

Note that writing s.t.foo works. In my opinion, this is the real bug.
Comment 3 dlangBugzillaToGithub 2024-12-13 18:17:10 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18776

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB