]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: std::make_signed_t<cv bool> should be ill-formed
authorJonathan Wakely <jwakely@redhat.com>
Fri, 7 Oct 2022 11:18:57 +0000 (12:18 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 10 Oct 2022 11:19:11 +0000 (12:19 +0100)
commit2bd112dee7f9786a0484d9281899a9bb0b2ae57d
tree54752d194ff6bea23e463eaea83be6a1132ecf50
parenta99f511c57b5b02edfd5969148c580b4a8737ee8
libstdc++: std::make_signed_t<cv bool> should be ill-formed

Currently we only reject std::make_signed_t<bool> but not cv bool.
Similarly for std::make_unsigned_t<cv bool>.

As well as making those ill-formed, this adds a requires-clause to the
make_signed and make_unsigned primary templates. This makes
non-integral, non-enum cases fail immediately with a clear error, rather
than giving an error about __make_signed_selector<T, false, false> being
incomplete.

libstdc++-v3/ChangeLog:

* include/std/type_traits (make_signed, make_unsigned): Add
specializations for cv bool. Add requires-clause for C++20 to
improve diagnostics for non-integral, non-enum cases.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
Check cv bool.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
Likewise.
* testsuite/24_iterators/range_access/range_access_cpp20_neg.cc:
Adjust expected errors for C++20 and later.
* testsuite/lib/prune.exp: Prune "in requirements  [with ...]"
lines from diagnostics.
libstdc++-v3/include/std/type_traits
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
libstdc++-v3/testsuite/24_iterators/range_access/range_access_cpp20_neg.cc
libstdc++-v3/testsuite/lib/prune.exp