Prechádzať zdrojové kódy

fix(functional): larger _data for vtable

greatbridf 1 rok pred
rodič
commit
4e0f5a1b06
1 zmenil súbory, kde vykonal 4 pridanie a 2 odobranie
  1. 4 2
      gblibstdc++/include/functional

+ 4 - 2
gblibstdc++/include/functional

@@ -148,7 +148,9 @@ public:
     using result_type = Ret;
 
 private:
-    char _data[sizeof(void*) * 2];
+    static constexpr std::size_t STACK_ALLOCATED_SIZE = 12;
+
+    char _data[STACK_ALLOCATED_SIZE];
     using fb_t = __inner::_function_base<Ret, Args...>;
     constexpr fb_t* _f(void) const
     {
@@ -181,7 +183,7 @@ public:
                 Ret,
                 decltype(std::declval<std::decay_t<FuncLike>>()(std::declval<Args>()...))
             >
-            && (sizeof(std::decay_t<FuncLike>) <= sizeof(_data))
+            && (sizeof(std::decay_t<FuncLike>) <= STACK_ALLOCATED_SIZE - sizeof(void*))
             && !std::is_same_v<std::decay_t<FuncLike>, function>
         , bool> = true
     >