Bug 15777 – Premature expansion of overload set in tuples
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-07T16:00:52Z
Last change time
2025-02-18T22:42:19Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Vladimir Panteleev
Comments
Comment #0 by dlang-bugzilla — 2016-03-07T16:00:52Z
/////////////////////// a.d //////////////////////
void fun() {}
/////////////////////// b.d //////////////////////
void fun() {}
///////////////////// test.d /////////////////////
alias AliasSeq(X...) = X;
template funA()
{
import a;
alias funA = fun;
}
template funB()
{
import b;
alias funB = fun;
}
template funAB()
{
import a;
import b;
alias funAB = fun;
}
void test(alias tpl)()
{
alias seq = AliasSeq!(tpl!());
foreach (i, n; seq)
pragma(msg, __traits(identifier, seq[i]));
}
void main()
{
test!funA;
test!funB;
test!funAB;
}
//////////////////////////////////////////////////
The AliasSeq iteration works when seq is a single function, but when it's an overload set, you get an error:
test.d(25): Error: variable test.test!(funAB).test.n variables cannot be of type void
test.d(25): Error: b.fun at b.d(1) conflicts with a.fun at a.d(1)
test.d(25): Error: expression fun() is void and has no value
fun
test.d(33): Error: template instance test.test!(funAB) error instantiating
Comment #1 by dlang-bugzilla — 2016-03-10T14:18:48Z