diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-01-28 13:24:09 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-01-28 13:24:09 +0000 |
commit | 72a9fd209b6db3b5f81fbb008e22ea93c00465e5 (patch) | |
tree | 235e12c87910903ae31d75f3818df290cfe2f5f2 | |
parent | 759812fddc81c0c131d4633b2a7f56412ce8dbed (diff) | |
download | gcc-72a9fd209b6db3b5f81fbb008e22ea93c00465e5.zip gcc-72a9fd209b6db3b5f81fbb008e22ea93c00465e5.tar.gz gcc-72a9fd209b6db3b5f81fbb008e22ea93c00465e5.tar.bz2 |
libstdc++: Avoid using sizeof with function types (PR 93470)
PR libstdc++/93470
* include/bits/refwrap.h (reference_wrapper::operator()): Restrict
static assertion to object types.
-rw-r--r-- | libstdc++-v3/ChangeLog | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/refwrap.h | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d75ebbc..c72d4a4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -10,6 +10,10 @@ 2020-01-28 Jonathan Wakely <jwakely@redhat.com> + PR libstdc++/93470 + * include/bits/refwrap.h (reference_wrapper::operator()): Restrict + static assertion to object types. + PR libstdc++/93325 * acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Use AC_SEARCH_LIBS for clock_gettime instead of explicit glibc version check. diff --git a/libstdc++-v3/include/bits/refwrap.h b/libstdc++-v3/include/bits/refwrap.h index 2bcd44d..717aa01 100644 --- a/libstdc++-v3/include/bits/refwrap.h +++ b/libstdc++-v3/include/bits/refwrap.h @@ -343,7 +343,8 @@ _GLIBCXX_MEM_FN_TRAITS(&& noexcept, false_type, true_type) operator()(_Args&&... __args) const { #if __cplusplus > 201703L - static_assert(sizeof(type), "type must be complete"); + if constexpr (is_object_v<type>) + static_assert(sizeof(type), "type must be complete"); #endif return std::__invoke(get(), std::forward<_Args>(__args)...); } |