summaryrefslogtreecommitdiff
path: root/glib/src
diff options
context:
space:
mode:
authorMagne Oestlyngen <magne@spacetec.no>2021-04-06 14:59:16 +0200
committerMagne Oestlyngen <magne@spacetec.no>2021-04-06 15:56:33 +0200
commit75bb943092d4584b8061376a16079a51f72d2f0a (patch)
treeed3517362c5058f4507640b720c9662c88985ed8 /glib/src
parentba1238301805d86ed1b4219375c1b26a998b684d (diff)
downloadglibmm-75bb943092d4584b8061376a16079a51f72d2f0a.tar.gz
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<class T> struct A { A<T>(); // 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.
Diffstat (limited to 'glib/src')
-rw-r--r--glib/src/variant.hg40
-rw-r--r--glib/src/variant_basictypes.h.m44
2 files changed, 22 insertions, 22 deletions
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index 0918d4d7..35f6bd83 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -457,7 +457,7 @@ public:
using CppContainerType = Variant<VariantBase>;
/// Default constructor.
- Variant<VariantBase>();
+ Variant();
/** GVariant constructor.
* @param castitem The GVariant to wrap.
@@ -465,7 +465,7 @@ public:
* GVariant or not (not taking one could destroy the GVariant with the
* wrapper).
*/
- explicit Variant<VariantBase>(GVariant* castitem, bool take_a_reference = false);
+ explicit Variant(GVariant* castitem, bool take_a_reference = false);
/** Gets the VariantType.
* @return The VariantType.
@@ -508,7 +508,7 @@ public:
using CppContainerType = Variant<CppType>;
/// Default constructor.
- Variant< Variant<T> >();
+ Variant();
/** GVariant constructor.
* @param castitem The GVariant to wrap.
@@ -517,7 +517,7 @@ public:
* wrapper).
* @newin{2,36}
*/
- explicit Variant< Variant<T> >(GVariant* castitem, bool take_a_reference = false);
+ explicit Variant(GVariant* castitem, bool take_a_reference = false);
/** Gets the VariantType.
* @return The VariantType.
@@ -554,7 +554,7 @@ public:
using CppType = Glib::ustring;
/// Default constructor.
- Variant<Glib::ustring>();
+ Variant();
/** GVariant constructor.
* @param castitem The GVariant to wrap.
@@ -562,7 +562,7 @@ public:
* GVariant or not (not taking one could destroy the GVariant with the
* wrapper).
*/
- explicit Variant<Glib::ustring>(GVariant* castitem, bool take_a_reference = false);
+ explicit Variant(GVariant* castitem, bool take_a_reference = false);
/** Gets the VariantType.
* @return The VariantType.
@@ -694,7 +694,7 @@ public:
using CppType = std::string;
/// Default constructor.
- Variant<std::string>();
+ Variant();
/** GVariant constructor.
* @param castitem The GVariant to wrap.
@@ -702,7 +702,7 @@ public:
* GVariant or not (not taking one could destroy the GVariant with the
* wrapper).
*/
- explicit Variant<std::string>(GVariant* castitem, bool take_a_reference = false);
+ explicit Variant(GVariant* castitem, bool take_a_reference = false);
/** Gets the VariantType.
* @return The VariantType.
@@ -735,7 +735,7 @@ public:
using CppContainerType = Variant<CppType>;
/// Default constructor.
- Variant< std::pair<K, V> >()
+ Variant()
: VariantContainerBase()
{}
@@ -745,7 +745,7 @@ public:
* GVariant or not (not taking one could destroy the GVariant with the
* wrapper).
*/
- explicit Variant< std::pair<K, V> >(GVariant* castitem,
+ explicit Variant(GVariant* castitem,
bool take_a_reference = false)
: VariantContainerBase(castitem, take_a_reference)
{}
@@ -784,7 +784,7 @@ public:
using CppContainerType = std::vector<T>;
/// Default constructor.
- Variant< std::vector<T> >()
+ Variant()
: VariantContainerBase()
{}
@@ -794,7 +794,7 @@ public:
* GVariant or not (not taking one could destroy the GVariant with the
* wrapper).
*/
- explicit Variant< std::vector<T> >(GVariant* castitem,
+ explicit Variant(GVariant* castitem,
bool take_a_reference = false)
: VariantContainerBase(castitem, take_a_reference)
{}
@@ -853,7 +853,7 @@ public:
using CppContainerType = std::vector<Glib::ustring>;
/// Default constructor.
- Variant< std::vector<Glib::ustring> >();
+ Variant();
/** GVariant constructor.
* @param castitem The GVariant to wrap.
@@ -861,7 +861,7 @@ public:
* GVariant or not (not taking one could destroy the GVariant with the
* wrapper).
*/
- explicit Variant< std::vector<Glib::ustring> >(GVariant* castitem, bool take_a_reference = false);
+ explicit Variant(GVariant* castitem, bool take_a_reference = false);
/** Gets the VariantType.
* @return The VariantType.
@@ -979,7 +979,7 @@ public:
using CppContainerType = std::vector<std::string>;
/// Default constructor.
- Variant< std::vector<std::string> >();
+ Variant();
/** GVariant constructor.
* @param castitem The GVariant to wrap.
@@ -987,7 +987,7 @@ public:
* GVariant or not (not taking one could destroy the GVariant with the
* wrapper).
*/
- explicit Variant< std::vector<std::string> >(GVariant* castitem, bool take_a_reference = false);
+ explicit Variant(GVariant* castitem, bool take_a_reference = false);
/** Gets the VariantType.
* @return The VariantType.
@@ -1055,7 +1055,7 @@ public:
using CppContainerType = std::map<K, V>;
/// Default constructor.
- Variant< std::map<K, V> >()
+ Variant()
: VariantContainerBase()
{}
@@ -1065,7 +1065,7 @@ public:
* GVariant or not (not taking one could destroy the GVariant with the
* wrapper).
*/
- explicit Variant< std::map<K, V> >(GVariant* castitem,
+ explicit Variant(GVariant* castitem,
bool take_a_reference = false)
: VariantContainerBase(castitem, take_a_reference)
{}
@@ -1128,7 +1128,7 @@ public:
using CppContainerType = std::tuple<Types...>;
/// Default constructor
- Variant<std::tuple<Types...>>()
+ Variant()
: VariantContainerBase()
{}
@@ -1137,7 +1137,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<std::tuple<Types...>>(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)
{}