fork download
  1. import std.traits;
  2. import std.range;
  3.  
  4. struct Test
  5. {
  6. bool empty() { return true; }
  7. int popFront() { return 10; }
  8. int front(int) { return 10; }
  9. }
  10.  
  11. auto test(Range)(Range r) {
  12. static assert(isInputRange!Range, "type '" ~ Range.stringof ~ "' must be an InputRange");
  13. }
  14.  
  15. void main() {
  16. Test t;
  17. test(t);
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.d(12): Error: static assert  "type 'Test' must be an InputRange"
prog.d(17):        instantiated from here: test!(Test)
stdout
Standard output is empty