libstdc++: Avoid using sizeof with function types (PR 93470)
authorJonathan Wakely <jwakely@redhat.com>
Tue, 28 Jan 2020 13:24:09 +0000 (13:24 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 28 Jan 2020 13:24:09 +0000 (13:24 +0000)
PR libstdc++/93470
* include/bits/refwrap.h (reference_wrapper::operator()): Restrict
static assertion to object types.

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/refwrap.h

index d75ebbc3662a6675a74786ba99b99dcc1f934bad..c72d4a43c80449e637dbcd1552bfd3107d7c850e 100644 (file)
 
 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.
index 2bcd44d3894668e476920d0713bc1101f98634db..717aa01629c7224618082965abd7cf5403fbcb1d 100644 (file)
@@ -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)...);
        }