On Saturday, 11 December 2021 at 23:44:59 UTC, Adam Ruppe wrote:
> On Saturday, 11 December 2021 at 23:17:17 UTC, Stanislav Blinov wrote:
> ? No. If it was unsatisfied constraint, the error would've shown that.
And if you try to instantiate it, you'll see it is an unsatisfied constraint anyway. There's two layers of failure here.
Using Unqual there is pretty iffy, i wouldn't bother with it at all, but if you do anything, instead qualify it const.
But either way, then the constraint still fails since int isn't unsigned.
I'd really recommend simplifying this a lot.
??? There is no unsatisfied constraint, it doesn't get there :)
> unq.d(6): Error: template unq.foo2
cannot deduce function from argument types !()(int)
unq.d(2): Candidate is: foo2(T)(Unqual!T x)
...because passed argument - int
- becomes Unqual!T
, making T
unknown - template arg list is empty. Deduction fails :) If int
is an Unqual!T
, what is T
? The constraint is testing T
.
Now, if you explicitly instantiate - sure, you'd get unsatisfied constraint. But the OP seems to want IFTI, which simply can't work here.
@apz28, I can't figure out the intent here. To convert result of abs to an unsigned?