Bug 4408 – Ambiguity when using std.algorithm.splitter with generic ranges

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-06-29T19:11:00Z
Last change time
2010-08-16T19:57:13Z
Assigned to
andrei
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2010-06-29T19:11:19Z
import std.algorithm; struct Range { int[] nums = [1,2,3,4,5,6,7,8,9,10]; @property int front() { return nums[0]; } void popFront() { nums = nums[1..$]; } @property bool empty() { return nums.length == 0; } @property typeof(this) save() { return this; } } void main() { Range r; auto split = splitter(r, 5); } d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(845): Error: template instance Splitter!(Range,int) matches more than one template declaration, d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(790):Splitter(Range,Separator) if (is(typeof(ElementType!(Range).init == Separator.init))) and d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1044):Splitter(alias isTerminator,Range,Slice = Select!(is(typeof(Range.init[0..1])),Range,ElementType!(Range)[])) d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(846): Error: Splitter!(Range,int) is used as a type d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(852): Error: function expected before (), not void of type void d:\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(25): Error: template instance std.algorithm.splitter!(Range,int) error instantiating test9.d(25): Error: variable test9.main.split voids have no value test9.d(25): Error: expression splitter(r,5) is void and has no value
Comment #1 by dsimcha — 2010-08-16T19:57:13Z
Fixed SVN.