[gcc r9-8345] libstdc++: Avoid using sizeof with function types (PR 93470)

Jonathan Wakely redi@gcc.gnu.org
Thu Mar 5 17:44:00 GMT 2020


https://gcc.gnu.org/g:08ed34284f4e6ac9a4e647d9caa82ee4b4de0fa3

commit r9-8345-g08ed34284f4e6ac9a4e647d9caa82ee4b4de0fa3
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Mar 5 16:52:19 2020 +0000

    libstdc++: Avoid using sizeof with function types (PR 93470)
    
    Backport from mainline
    2020-01-28  Jonathan Wakely  <jwakely@redhat.com>
    
    	PR libstdc++/93470
    	* include/bits/refwrap.h (reference_wrapper::operator()): Restrict
    	static assertion to object types.

Diff:
---
 libstdc++-v3/ChangeLog              | 16 ++++++++++++++++
 libstdc++-v3/include/bits/refwrap.h |  3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index bcac851..e997841 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,19 @@
+2020-03-05  Jonathan Wakely  <jwakely@redhat.com>
+
+	Backport from mainline
+	2020-01-28  Jonathan Wakely  <jwakely@redhat.com>
+
+	PR libstdc++/93470
+	* include/bits/refwrap.h (reference_wrapper::operator()): Restrict
+	static assertion to object types.
+
+2020-01-28  Jonathan Wakely  <jwakely@redhat.com>
+
+	PR libstdc++/93325
+	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Use AC_SEARCH_LIBS for
+	clock_gettime instead of explicit glibc version check.
+	* configure: Regenerate.
+
 2020-03-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Updated.
diff --git a/libstdc++-v3/include/bits/refwrap.h b/libstdc++-v3/include/bits/refwrap.h
index 6b4335a..d95f7c5 100644
--- a/libstdc++-v3/include/bits/refwrap.h
+++ b/libstdc++-v3/include/bits/refwrap.h
@@ -334,7 +334,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)...);
 	}



More information about the Libstdc++-cvs mailing list