D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7418 - Overloading doesn't work with aliases declared inside templates
Summary: Overloading doesn't work with aliases declared inside templates
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: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2012-02-01 11:34 UTC by siegelords_abode
Modified: 2012-04-18 16:14 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 siegelords_abode 2012-02-01 11:34:05 UTC
void test(uint a)
{

}

void test(char[] a)
{

}

template _test1(T = void)
{
	alias test _test1;
}

alias test _test2;

void main()
{
	_test2("a".dup);
	_test2(1U);
	
	_test1!()("a".dup); // Error: cannot implicitly convert expression (_adDupT(&_D12TypeInfo_Aya6__initZ,cast(string)"a")) of type char[] to uint
	_test1!()(1U);
}

Note how the alias outside the template works fine, but the one inside the alias only picks up the lexically first match. Note that this works fine in D1.
Comment 2 github-bugzilla 2012-04-18 15:46:09 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/85d53d2ae46190f3fe5a1788594b15ee4cb7f0f4
fix Issue 7418 - Overloading doesn't work with aliases declared inside templates

https://github.com/D-Programming-Language/dmd/commit/83acb3b4e58c1abe4e74f30819fb60490b547ff9
Merge pull request #886 from 9rnsr/fix7418

Issue 7418 - Overloading doesn't work with aliases declared inside templates