diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2023-03-29 22:02:19 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2023-03-30 00:06:25 +0100 |
commit | 14f50ba054079eccf9ac49997b92793e2a87b13c (patch) | |
tree | 03adda7ad1ed84f458d6709b6d8f01713d875af2 /gcc/range-op-float.cc | |
parent | 68982b98d2a7a52cfc5aada7d35d6c493c010712 (diff) | |
download | gcc-14f50ba054079eccf9ac49997b92793e2a87b13c.zip gcc-14f50ba054079eccf9ac49997b92793e2a87b13c.tar.gz gcc-14f50ba054079eccf9ac49997b92793e2a87b13c.tar.bz2 |
libstdc++: Enforce requirements on template argument of std::optional
The standard does not allow std::optional<T&>, std::optional<T[1]>,
std::optional<T()> etc. and although we do give errors, they come from
down inside the internals of std::optional. We could improve the static
assertions at the top of the class so that users get a more precise
diagnostic:
optional:721:21: error: static assertion failed
721 | static_assert(is_object_v<_Tp> && !is_array_v<_Tp>);
libstdc++-v3/ChangeLog:
* include/std/optional (optional): Adjust static assertion to
reject arrays and functions as well as references.
* testsuite/20_util/optional/requirements_neg.cc: New test.
Diffstat (limited to 'gcc/range-op-float.cc')
0 files changed, 0 insertions, 0 deletions