[Issue 15777] New: Premature expansion of overload set in tuples
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Mar 7 08:00:52 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15777
Issue ID: 15777
Summary: Premature expansion of overload set in tuples
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: thecybershadow at gmail.com
/////////////////////// 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
--
More information about the Digitalmars-d-bugs
mailing list