Boost logo

Boost :

Subject: Re: [boost] C++11 decltype/SFINAE puzzler
From: Eric Niebler (eric_at_[hidden])
Date: 2012-08-13 14:36:47


On 8/13/2012 12:46 AM, John Maddock wrote:
>> Right. It can be easily turned into a compile-time error by
>> static_assert'ing that the function's return type is not sfinae_error,
>> but the compiler error wouldn't be informative. You'd have to run to
>> code to see the error.
>>
>> I was hoping to have a way to transport the error to an API boundary and
>> reporting it there, instead of presenting users with an imposing
>> template instantiation backtrace, but that might not be possible.
>
> I haven't followed this discussion, but you can move static_assert's up
> the call stack by moving the condition into an enable/disable_if, then
> the compiler simply doesn't find the function and you get the error
> "sooner".
>
> But you've probably considered all this already yours, John.

John, what you're describing is precisely what we're trying to avoid: a
mysterious "cannot find function" error because the function has been
SFINAE'd out ... but where and why? The programmer needs better feedback
than that.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk