From 11767f80f0be06988b3b317ae0205ae9f79c190c Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Tue, 26 Mar 2019 14:41:59 +0200 Subject: [PATCH] re PR libstdc++/89824 (Variant jump table reserves space for __variant_cookie twice) PR libstdc++/89824 Fix based on a suggestion by Antony Polukhin. * include/std/variant (__gen_vtable): Don't reserve an additional table slot, _Multi_array already does that. From-SVN: r269941 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/std/variant | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 91d8dbc9a3e..62242607674 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2019-03-26 Ville Voutilainen + + PR libstdc++/89824 + Fix based on a suggestion by Antony Polukhin. + * include/std/variant (__gen_vtable): Don't reserve an + additional table slot, _Multi_array already does that. + 2019-03-26 Ville Voutilainen PR libstdc++/89816 diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 0984e13725a..36314638e63 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -904,9 +904,7 @@ namespace __variant using _Func_ptr = _Result_type (*)(_Visitor&&, _Variants...); using _Array_type = _Multi_array<_Func_ptr, - (variant_size_v> - + (is_same_v<_Result_type, __variant_cookie> ? 1 : 0)) - ...>; + variant_size_v>...>; static constexpr _Array_type _S_apply() -- 2.30.2