[PATCH] PR libstdc++/71579 assert that type traits are not misused with an incomplete type

Ville Voutilainen ville.voutilainen@gmail.com
Thu Jun 20 17:57:00 GMT 2019


On Thu, 20 Jun 2019 at 20:49, Antony Polukhin <antoshkka@gmail.com> wrote:
>
> чт, 6 июн. 2019 г. в 15:19, Jonathan Wakely <jwakely@redhat.com>:
> > I'm removing some of these assertions again, because they are either
> > reundant or wrong.
>
> Thanks for cleaning up!
>
>
> In attachment there is an additional patch for type traits hardening.
>
> Things that still remain unasserted are type traits  with variadic
> template arguments. I have to came up with a proper solution for
> providing a useful and lightweight diagnostics.

I see a
public __bool_constant<__is_trivially_assignable(_Tp, _Up)>
in this patch, followed by a trait-body that static_asserts. In such
cases, I think we want
to
a) be really careful about duplicating compiler diagnostics with library ones
b) look at the compiler diagnostics, and if they are lacking, improve them.

...because that's what Jonathan's cleanup was really about.
In the test modifications of __is_trivially_assignable, this looks bloody
suspicious:

+// { dg-prune-output "invalid use of incomplete type" }
+// { dg-prune-output "must be a complete" }

No. Don't merge. We are not replacing diagnostics A with diagnostics
B, we are ignoring existing
diagnostics and adding more. Which is exactly what Jonathan's cleanup avoided.



More information about the Libstdc++ mailing list