Bug 7418 – Overloading doesn't work with aliases declared inside templates
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-01T11:34:00Z
Last change time
2012-04-18T16:14:40Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
siegelords_abode
Comments
Comment #0 by siegelords_abode — 2012-02-01T11:34:05Z
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.