Type Parameter Deduction
Ali Çehreli
acehreli at yahoo.com
Tue May 10 14:42:31 UTC 2022
On 5/10/22 06:14, Salih Dincer wrote:
> Not compiled, the compiler returns:
What would you like to see instead? The compiler can reject code only by
"not compiling". :)
>> InclusiveRange.d(48): Error: template instance
>> `InclusiveRange.ir!bool` does not match > template declaration
>> `inclusiveRange(T = int)(T f = T(0), T l = T(0), T s = T(1))`
>> with `T = bool`
>> must satisfy the following constraint:
>> ` !is(T == bool)`
It explains the problem by displaying the reason on the last line.
So, the assumption is that inclusiveRange's documentation makes it clear
that it cannot be used with 'bool' and the user sees a compilation error
if they try to do that.
Ali
More information about the Digitalmars-d-learn
mailing list