libstdc++: assert that type traits are not misused with incomplete types [PR 71579]
authorAntony Polukhin <antoshkka@gmail.com>
Wed, 19 Aug 2020 11:10:57 +0000 (12:10 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 19 Aug 2020 11:12:40 +0000 (12:12 +0100)
commit69f571ffc513b689fa26e4c9fceba17c2c989ab3
treefc2a28c5020330413c5cbd0a0e3aed069ed46c72
parenta5a635fc4331b6d5f1a1e688e1153abd2ff194a5
libstdc++: assert that type traits are not misused with incomplete types [PR 71579]

libstdc++-v3/ChangeLog:

2020-08-19  Antony Polukhin  <antoshkka@gmail.com>

PR libstdc++/71579
* include/std/type_traits (invoke_result, is_nothrow_invocable_r)
Add static_asserts to make sure that the argument of the type
trait is not misused with incomplete types.
(is_swappable_with, is_nothrow_swappable_with): Add static_asserts
to make sure that the first and second arguments of the type trait
are not misused with incomplete types.
* testsuite/20_util/invoke_result/incomplete_neg.cc: New test.
* testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc: New test.
* testsuite/20_util/is_nothrow_swappable/incomplete_neg.cc: New test.
* testsuite/20_util/is_nothrow_swappable_with/incomplete_neg.cc: New
test.
* testsuite/20_util/is_swappable_with/incomplete_neg.cc: New test.
libstdc++-v3/include/std/type_traits
libstdc++-v3/testsuite/20_util/invoke_result/incomplete_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/is_nothrow_swappable/incomplete_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/is_nothrow_swappable_with/incomplete_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/is_swappable_with/incomplete_neg.cc [new file with mode: 0644]