Bug 7553 – auto template param triggers mixin conflict
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-20T12:38:00Z
Last change time
2015-02-18T03:36:53Z
Assigned to
nobody
Creator
ellery-newcomer
Comments
Comment #0 by ellery-newcomer — 2012-02-20T12:38:40Z
dmd 2.058
the code:
template Foo(){
struct Range{
}
}
template Biz(){
struct Range{
}
}
class Bar{
mixin Foo!() index0;
mixin Biz!() index1;
auto to_range(Range)(Range r)
{
}
}
void main(){
auto r2 =Bar.to_range(1);
}
the fireworks:
test.d(13): Error: test.Bar.Foo!().Range at test.d(2) conflicts with test.Bar.Biz!().Range at test.d(6)
Comment #1 by hsteoh — 2014-07-30T00:59:27Z
Seems to work in git HEAD, after fixing some errors in the code:
------
template Foo(){
struct Range{
}
}
template Biz(){
struct Range{
}
}
class Bar{
mixin Foo!() index0;
mixin Biz!() index1;
auto to_range(Range)(Range r)
{
return r; // have to return something for r2 to have non-void type
}
}
void main(){
auto r2 =Bar.init.to_range(1); // have to use .init to pass actual value to to_range
}
------
With these changes, it can compile successfully; no more conflict errors. So looks like the bug has been fixed in git HEAD.
Comment #2 by github-bugzilla — 2014-09-14T21:55:50Z