From 533467d49fbf48b2febbdde68ca908402908e4d8 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 13 Apr 2021 09:52:24 +0200 Subject: [PATCH] Backport upstream fix for C++20 compatibility https://gitlab.gnome.org/GNOME/glibmm/-/merge_requests/50 https://bugzilla.redhat.com/show_bug.cgi?id=1947838 Resolves: #1951127 (cherry picked from Fedora commit fdd8d944ad287e27a6f6c65429946e3ed16582e7) --- 0001-Variant-Fix-so-it-works-with-C-20.patch | 236 +++++++++++++++++++ glibmm24.spec | 5 + 2 files changed, 241 insertions(+) create mode 100644 0001-Variant-Fix-so-it-works-with-C-20.patch diff --git a/0001-Variant-Fix-so-it-works-with-C-20.patch b/0001-Variant-Fix-so-it-works-with-C-20.patch new file mode 100644 index 0000000..5693f07 --- /dev/null +++ b/0001-Variant-Fix-so-it-works-with-C-20.patch @@ -0,0 +1,236 @@ +From f40371dae96ae340b752a985621598439f09ad40 Mon Sep 17 00:00:00 2001 +From: Magne Oestlyngen +Date: Tue, 6 Apr 2021 14:59:16 +0200 +Subject: [PATCH] Variant: Fix so it works with C++20 + +C++20 changed some aspects of templates that broke variant.h on +some compilers (GCC 11). + +Ref: https://wg21.cmeerw.net/cwg/issue2237 + + template + struct A { + A(); // ok pre-C++20, now incorrect +// A(); // correct for all versions + }; + +This commit removes the "simple-template-id" from both the default +constructor (no args) and the explicit constructor (has args), even +though only the default constructor currently gives error on GCC 11. +Since both versions are wrong according to the issue referred to above +it is expected that GCC (and possibly other compilers) will be updated +to fail on both cases in the future. +--- + glib/src/variant.hg | 40 ++++++++++++++++---------------- + glib/src/variant_basictypes.h.m4 | 4 ++-- + 2 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/glib/src/variant.hg b/glib/src/variant.hg +index 807e52ef..011aa994 100644 +--- a/glib/src/variant.hg ++++ b/glib/src/variant.hg +@@ -470,7 +470,7 @@ public: + using CppContainerType = Variant; + + /// Default constructor. +- Variant(); ++ Variant(); + + /** GVariant constructor. + * @param castitem The GVariant to wrap. +@@ -478,7 +478,7 @@ public: + * GVariant or not (not taking one could destroy the GVariant with the + * wrapper). + */ +- explicit Variant(GVariant* castitem, bool take_a_reference = false); ++ explicit Variant(GVariant* castitem, bool take_a_reference = false); + + /** Gets the VariantType. + * @return The VariantType. +@@ -521,7 +521,7 @@ public: + using CppContainerType = Variant; + + /// Default constructor. +- Variant< Variant >(); ++ Variant(); + + /** GVariant constructor. + * @param castitem The GVariant to wrap. +@@ -530,7 +530,7 @@ public: + * wrapper). + * @newin{2,36} + */ +- explicit Variant< Variant >(GVariant* castitem, bool take_a_reference = false); ++ explicit Variant(GVariant* castitem, bool take_a_reference = false); + + /** Gets the VariantType. + * @return The VariantType. +@@ -567,7 +567,7 @@ public: + using CppType = Glib::ustring; + + /// Default constructor. +- Variant(); ++ Variant(); + + /** GVariant constructor. + * @param castitem The GVariant to wrap. +@@ -575,7 +575,7 @@ public: + * GVariant or not (not taking one could destroy the GVariant with the + * wrapper). + */ +- explicit Variant(GVariant* castitem, bool take_a_reference = false); ++ explicit Variant(GVariant* castitem, bool take_a_reference = false); + + /** Gets the VariantType. + * @return The VariantType. +@@ -711,7 +711,7 @@ public: + using CppType = std::string; + + /// Default constructor. +- Variant(); ++ Variant(); + + /** GVariant constructor. + * @param castitem The GVariant to wrap. +@@ -719,7 +719,7 @@ public: + * GVariant or not (not taking one could destroy the GVariant with the + * wrapper). + */ +- explicit Variant(GVariant* castitem, bool take_a_reference = false); ++ explicit Variant(GVariant* castitem, bool take_a_reference = false); + + /** Gets the VariantType. + * @return The VariantType. +@@ -756,7 +756,7 @@ public: + using CppContainerType = Variant; + + /// Default constructor. +- Variant< std::pair >() ++ Variant() + : VariantContainerBase() + {} + +@@ -766,7 +766,7 @@ public: + * GVariant or not (not taking one could destroy the GVariant with the + * wrapper). + */ +- explicit Variant< std::pair >(GVariant* castitem, ++ explicit Variant(GVariant* castitem, + bool take_a_reference = false) + : VariantContainerBase(castitem, take_a_reference) + {} +@@ -805,7 +805,7 @@ public: + using CppContainerType = std::vector; + + /// Default constructor. +- Variant< std::vector >() ++ Variant() + : VariantContainerBase() + {} + +@@ -815,7 +815,7 @@ public: + * GVariant or not (not taking one could destroy the GVariant with the + * wrapper). + */ +- explicit Variant< std::vector >(GVariant* castitem, ++ explicit Variant(GVariant* castitem, + bool take_a_reference = false) + : VariantContainerBase(castitem, take_a_reference) + {} +@@ -874,7 +874,7 @@ public: + using CppContainerType = std::vector; + + /// Default constructor. +- Variant< std::vector >(); ++ Variant(); + + /** GVariant constructor. + * @param castitem The GVariant to wrap. +@@ -882,7 +882,7 @@ public: + * GVariant or not (not taking one could destroy the GVariant with the + * wrapper). + */ +- explicit Variant< std::vector >(GVariant* castitem, bool take_a_reference = false); ++ explicit Variant(GVariant* castitem, bool take_a_reference = false); + + /** Gets the VariantType. + * @return The VariantType. +@@ -1000,7 +1000,7 @@ public: + using CppContainerType = std::vector; + + /// Default constructor. +- Variant< std::vector >(); ++ Variant(); + + /** GVariant constructor. + * @param castitem The GVariant to wrap. +@@ -1008,7 +1008,7 @@ public: + * GVariant or not (not taking one could destroy the GVariant with the + * wrapper). + */ +- explicit Variant< std::vector >(GVariant* castitem, bool take_a_reference = false); ++ explicit Variant(GVariant* castitem, bool take_a_reference = false); + + /** Gets the VariantType. + * @return The VariantType. +@@ -1076,7 +1076,7 @@ public: + using CppContainerType = std::map; + + /// Default constructor. +- Variant< std::map >() ++ Variant() + : VariantContainerBase() + {} + +@@ -1086,7 +1086,7 @@ public: + * GVariant or not (not taking one could destroy the GVariant with the + * wrapper). + */ +- explicit Variant< std::map >(GVariant* castitem, ++ explicit Variant(GVariant* castitem, + bool take_a_reference = false) + : VariantContainerBase(castitem, take_a_reference) + {} +@@ -1149,7 +1149,7 @@ public: + using CppContainerType = std::tuple; + + /// Default constructor +- Variant>() ++ Variant() + : VariantContainerBase() + {} + +@@ -1158,7 +1158,7 @@ public: + * @param take_a_reference Whether to take an extra reference of the GVariant + * or not (not taking one could destroy the GVariant with the wrapper). + */ +- explicit Variant>(GVariant* castitem, bool take_a_reference = false) ++ explicit Variant(GVariant* castitem, bool take_a_reference = false) + : VariantContainerBase(castitem, take_a_reference) + {} + +diff --git a/glib/src/variant_basictypes.h.m4 b/glib/src/variant_basictypes.h.m4 +index 199295b9..f73992fd 100644 +--- a/glib/src/variant_basictypes.h.m4 ++++ b/glib/src/variant_basictypes.h.m4 +@@ -45,7 +45,7 @@ public: + using CType = $2; + + /// Default constructor. +- Variant<$1>() ++ Variant() + : VariantBase() + {} + +@@ -55,7 +55,7 @@ public: + * GVariant or not (not taking one could destroy the GVariant with the + * wrapper). + */ +- explicit Variant<$1>(GVariant* castitem, bool take_a_reference = false) ++ explicit Variant(GVariant* castitem, bool take_a_reference = false) + : VariantBase(castitem, take_a_reference) + {} + +-- +2.30.2 + diff --git a/glibmm24.spec b/glibmm24.spec index 6bee85f..6bcc284 100644 --- a/glibmm24.spec +++ b/glibmm24.spec @@ -12,7 +12,11 @@ Summary: C++ interface for the GLib library License: LGPLv2+ URL: http://www.gtkmm.org/ Source0: http://ftp.gnome.org/pub/GNOME/sources/glibmm/%{release_version}/glibmm-%{version}.tar.xz + Patch0: %{name}-gcc11.patch +# Backported from upstream +# https://gitlab.gnome.org/GNOME/glibmm/-/merge_requests/50 +Patch1: 0001-Variant-Fix-so-it-works-with-C-20.patch BuildRequires: doxygen BuildRequires: gcc-c++ @@ -97,6 +101,7 @@ chmod +x $RPM_BUILD_ROOT%{_libdir}/glibmm-2.4/proc/gmmproc %changelog * Fri May 07 2021 Kalev Lember - 2.66.0-1 - Update to 2.66.0 +- Backport upstream fix for C++20 compatibility (#1947838) * Thu Apr 15 2021 Mohan Boddu - 2.64.5-5 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937