From 1008da752b135e41e26bc9fedeaffe824046be4e Mon Sep 17 00:00:00 2001 From: Peter Alexander Date: Tue, 1 Jan 2013 21:17:06 +0000 Subject: [PATCH] Issue 8367 - Insufficient constraints for chain The error message from compiling the bug's sample code after this change is: ``` bug.d(11): Error: template std.range.chain does not match any function template declaration. Candidates are: std/range.d(2018): std.range.chain(Ranges...)(Ranges rs) if (Ranges.length > 0 && allSatisfy!(isInputRange, staticMap!(Unqual, Ranges)) && !is(CommonType!(staticMap!(ElementType, staticMap!(Unqual, Ranges))) == void)) bug.d(11): Error: template std.range.chain(Ranges...)(Ranges rs) if (Ranges.length > 0 && allSatisfy!(isInputRange, staticMap!(Unqual, Ranges)) && !is(CommonType!(staticMap!(ElementType, staticMap!(Unqual, Ranges))) == void)) cannot deduce template function from argument types !()(MapResult!(__lambda2, Foo[]),string) ``` Fixes Issue 8367 http://d.puremagic.com/issues/show_bug.cgi?id=8367 --- std/range.d | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/std/range.d b/std/range.d index 8af6ac0c9..46c829355 100644 --- a/std/range.d +++ b/std/range.d @@ -2016,7 +2016,9 @@ assert(equal(s, [1, 2, 3, 4, 5, 6, 7][])); ---- */ auto chain(Ranges...)(Ranges rs) -if (Ranges.length > 0 && allSatisfy!(isInputRange, staticMap!(Unqual, Ranges))) +if (Ranges.length > 0 && + allSatisfy!(isInputRange, staticMap!(Unqual, Ranges)) && + !is(CommonType!(staticMap!(ElementType, staticMap!(Unqual, Ranges))) == void)) { static if (Ranges.length == 1) {