dbgVerifySorted is not nothrow
    Panke via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sun Nov  8 00:05:36 PST 2015
    
    
  
I've updated my compiler and ran into this regression:
https://issues.dlang.org/show_bug.cgi?id=14981
Code:
---
import std.algorithm, std.container;
void main()
{
	static bool compare(P a, P b)
	{
		return a.curColumn < b.curColumn;
	}
	Array!P a = make!(Array!P);
	sort!compare(a[]);
}
struct P
{
	int curColumn = 0;
}
---
Result:
/usr/include/dlang/dmd/std/algorithm/sorting.d(982): Error: 
template instance std.range.assumeSorted!(compare, 
RangeT!(Array!(P))) error instantiating
tmp.d(10):        instantiated from here: sort!(compare, 
cast(SwapStrategy)0, RangeT!(Array!(P)))
1 tobias at akela ~ [i] % dmd -debug tmp.d
/usr/include/dlang/dmd/std/range/package.d(7189): Error: 
'std.range.SortedRange!(RangeT!(Array!(P)), 
compare).SortedRange.dbgVerifySorted' is not nothrow
/usr/include/dlang/dmd/std/algorithm/sorting.d(982): Error: 
template instance std.range.assumeSorted!(compare, 
RangeT!(Array!(P))) error instantiating
tmp.d(10):        instantiated from here: sort!(compare, 
cast(SwapStrategy)0, RangeT!(Array!(P)))
What I don't understand is, why dbgVerifySorted has to be nothrow 
in the first place. Is that an new requirement for contracts? I 
couldn't find any hint in the language spec.
    
    
More information about the Digitalmars-d-learn
mailing list