[Issue 4217] Function overloads are not distinguished when instantiating templates
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 21 11:16:47 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4217
Shin Fujishiro <rsinfu at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #641 is|0 |1
obsolete| |
--- Comment #3 from Shin Fujishiro <rsinfu at gmail.com> 2010-09-21 11:16:09 PDT ---
Created an attachment (id=762)
Patch against dmd r680, implements FuncDeclaration::equals()
Updated patch and a cleaned up test case.
-------------------- test.d
template Return(alias fun)
{
static if (is(typeof(fun) R == return)) alias R Return;
}
interface I
{
int square(int n);
real square(real n);
}
alias Return!( __traits(getOverloads, I, "square")[0] ) R0;
alias Return!( __traits(getOverloads, I, "square")[1] ) R1;
static assert(! is(R0 == R1)); // (14)
--------------------
% dmd -o- -c test.d
test.d(14): Error: static assert (!true) is false
--------------------
The problem is that template alias (symbol) parameters are matched in terms of
the identifier via Dsymbol::equals(). The new patch implements
FuncDeclaration::equals() that checks for function type.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list