libstdc++: assert that type traits are not misused with incomplete types [PR 71579]
authorAntony Polukhin <antoshkka@gmail.com>
Thu, 24 Sep 2020 17:51:37 +0000 (18:51 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 24 Sep 2020 17:51:37 +0000 (18:51 +0100)
commitc1fc9f6e10e646f01194c8f150affbc1cfbc404a
tree95e8dc4ec6086c2f7be3711c4a562eb47ff925ca
parent42907ca9a495a4a535bbd995fa126afb76012023
libstdc++: assert that type traits are not misused with incomplete types [PR 71579]

libstdc++-v3/ChangeLog:

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 type usage in trait.
libstdc++-v3/include/std/type_traits
libstdc++-v3/testsuite/20_util/invoke_result/incomplete_args_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/is_invocable/incomplete_args_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/is_invocable/incomplete_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_args_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc