4 fail_compilation/test8556.d(24): Error: template instance `test8556.Grab!(Circle!(uint[]))` does not match template declaration `Grab(Range)`
5 with `Range = Circle!(uint[])`
6 must satisfy the following constraint:
8 fail_compilation/test8556.d(55): Error: template instance `test8556.grab!(Circle!(uint[]))` error instantiating
12 extern(C
) int printf(const char*, ...);
14 template isSliceable(R
)
16 enum bool isSliceable
= is(typeof( R
.init
[1 .. 2] ));
19 struct Grab(Range
) if (!isSliceable
!Range
)
24 Grab
!R
grab(R
)(R input
)
29 // 3. evaluate isSliceable in template constraint
30 auto grabExactly(R
)(R range
) if (!isSliceable
!R
) { return 0; }
31 auto grabExactly(R
)(R range
) if ( isSliceable
!R
) { return 0; }
35 // 2. auto return opSlice
36 auto opSlice(size_t i
, size_t j
)
38 //pragma(msg, typeof(opSlice)); // prints "fwdref err" with B, but doesn't with A
40 printf("%d %d\n", cast(int)i
, cast(int)j
);
43 // 1. grabExactly curcular refers this opSlice.
44 return grabExactly(typeof(this)()); // broken execution with A
55 auto t
= grab(circle
!(uint[])());
57 auto cx
= circle
!(uint[])();
58 auto slice
= cx
[23 .. 33];