Boost logo

Boost :

Subject: Re: [boost] C++11 decltype/SFINAE puzzler
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2012-07-06 20:43:23


> From: doug.gregor_at_[hidden]
> On Fri, Jul 6, 2012 at 1:23 PM, Eric Niebler <eric_at_[hidden]> wrote:
> > On 7/6/2012 12:54 PM, Marc Glisse wrote:
> >> On Fri, 6 Jul 2012, Eric Niebler wrote:
> >>> The end result is that the user is presented with an error like: "no
> >>> viable function A, template substitution failed." The user is given no
> >>> information about which function in the chain failed to compile, or why.
> >>> This is a serious usability problem!
> >>
> >> ... in your compiler.
> >>
> >>> All suggestions welcome,
> >>
> >> Use g++.
> > <snip informative backtrace>
> >
> > Ah! Thanks. I'm using clang. I agree, it's a compiler QoI issue. I'll
> > follow up with them.
>
> FWIW, top-of-tree Clang produces:
>
> t.cpp:12:3: error: no matching function for call to 'f'
> f(0);
> ^
> t.cpp:8:8: note: candidate template ignored: substitution failure
> [with T = int]: no matching function for call to 'g'
> auto f(T x) -> decltype(g(x)) { return g(x); };
> ^ ~
>
> Which could probably still be improved, although I can't convince
> myself that GCC 4.8 is doing us favors by producing the complete
> SFINAE backtrace.

I think that as a matter of principle, more information is better than
less. The raw error message can relatively easily be parsed by a tool
that filters out undesired detail, but if the detail is not emitted in
the first place, it's gone.

Regards,
Nate
                                               


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