From 6daa57a261a1b5885a70de731ccb75bd556a1631 Mon Sep 17 00:00:00 2001 From: qchikara Date: Tue, 6 May 2014 21:52:56 +0900 Subject: [PATCH] WorkAround 12661: To make SortedRange#this() nothrow Debug statements prevent this function from nothrow. So I take them out of the function body and put them into the postcontract which has another context. --- std/range.d | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/std/range.d b/std/range.d index b34d83849e1..5d914ff4821 100644 --- a/std/range.d +++ b/std/range.d @@ -8335,8 +8335,19 @@ if (isInputRange!Range) // Undocummented because a clearer way to invoke is by calling // assumeSorted. this(Range input) + out + { + // moved out of the body as a workaround for Issue 12661 + dbgVerifySorted(); + } + body { this._input = input; + } + + // Assertion only. + private void dbgVerifySorted() + { if(!__ctfe) debug {