[Issue 1451] New: overloading methods by mixin in static if doesn't work
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Aug 29 11:26:43 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1451
Summary: overloading methods by mixin in static if doesn't work
Product: D
Version: 1.020
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: leo.dahlmann at gmail.com
<code>
template Foo(T)
{
void callme(T)
{
}
}
class Bar
{
mixin Foo!(int) F1;
alias F1.callme callme;
static if(true)
{
mixin Foo!(float) F2;
alias F2.callme callme;
}
}
void main()
{
Bar bar = new Bar;
bar.callme(cast(int)0); // <- works
bar.callme(cast(float)0); // <- fails (line 25)
}
</code>
This code fails to compile with these error messages:
test.d(25): function test.Bar.Foo!(int).callme ((int _param_0)) does not match
parameter types (float)
test.d(25): Error: cannot implicitly convert expression (0) of type float to
int
After commenting out the static if it compiles perfectly, like expected.
--
More information about the Digitalmars-d-bugs
mailing list