[Bug c++/85965] G++ gives cryptic error instead of incomplete type

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 29 11:51:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85965

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
There's nothing that can be done here. The error comes from the library (not
the compiler) and there's no way the compiler can possibly say "the static
assertion would have passed if the __is_invocable trait had been true, which
might have happened if the type was complete so that a conversion sequence from
const Biz* to const Bar* might be possible".

The is_invocable trait asks if that function object can be called with those
arguments, and when Biz is incomplete the answer is no.

I think sadly I have to remove that static_assertion, or just make it happen
later when the comparison function is used (by which point either the call
works, or you get an error anyway and the static assertion doesn't add any
value).


More information about the Gcc-bugs mailing list