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

Jonathan Wakely jwakely@redhat.com
Thu Sep 24 17:53:01 GMT 2020


On 20/08/20 18:31 +0300, Antony Polukhin via Libstdc++ wrote:
>ср, 19 авг. 2020 г. в 14:29, Jonathan Wakely <jwakely@redhat.com>:
><...>
>> Do we also want to check
>> (std::__is_complete_or_unbounded(__type_identity<_ArgTypes>{}) && ...)
>> for invoke_result and the is_invocable traits?
>
>Done.
>
>Changelog:
>
>2020-08-20  Antony Polukhin  <antoshkka@gmail.com>
>
>    PR libstdc/71579
>    * include/std/type_traits (invoke_result, is_invocable, is_invocable_r)
>    (is_nothrow_invocable, is_nothrow_invocable_r): Add static_asserts
>    to make sure that the arguments of the type traits are not misused
>    with incomplete types.`
>    * testsuite/20_util/invoke_result/incomplete_args_neg.cc: New test.
>    * testsuite/20_util/is_invocable/incomplete_args_neg.cc: New test.
>    * testsuite/20_util/is_invocable/incomplete_neg.cc: New test.
>    * testsuite/20_util/is_nothrow_invocable/incomplete_args_neg.cc: New test.
>    * testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc: Check for
>    error on incomplete response type usage in trait.

Committed with some tweaks to the static assert messages to say:

"each argument type must be a complete class or an unbounded array"

Thanks!




More information about the Libstdc++ mailing list