From dafd7a791a130cb7577eb4742804a208c6418d4e Mon Sep 17 00:00:00 2001 From: Marek Szanyi Date: Tue, 29 May 2018 13:36:49 +0200 Subject: [PATCH 1/2] Provide compiler specific ctor for Struct --- include/sdbus-c++/Types.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/sdbus-c++/Types.h b/include/sdbus-c++/Types.h index 3ff9050..5920e04 100644 --- a/include/sdbus-c++/Types.h +++ b/include/sdbus-c++/Types.h @@ -98,12 +98,13 @@ namespace sdbus { public: using std::tuple<_ValueTypes...>::tuple; - // Workaround for clang (where the above constructor inheritance doesn't work) - // However, with this ctor, it doesn't work on gcc :-( TODO Investigate proper solution. - //Struct(const std::tuple<_ValueTypes...>& t) - // : std::tuple<_ValueTypes...>(t) - //{ - //} + // Constructor for GCC 7.1.0 and above +#if __GNUC__ > 7 || (__GNUC__ == 7 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 0)) + Struct(const std::tuple<_ValueTypes...>& t) + : std::tuple<_ValueTypes...>(t) + { + } +#endif template auto& get() From a395adbecfd1e206a6b10d2aef95915534580ae7 Mon Sep 17 00:00:00 2001 From: Marek Szanyi Date: Tue, 5 Jun 2018 15:52:59 +0200 Subject: [PATCH 2/2] Change in logic when constructor is available --- include/sdbus-c++/Types.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/sdbus-c++/Types.h b/include/sdbus-c++/Types.h index 5920e04..0c7f901 100644 --- a/include/sdbus-c++/Types.h +++ b/include/sdbus-c++/Types.h @@ -98,9 +98,11 @@ namespace sdbus { public: using std::tuple<_ValueTypes...>::tuple; - // Constructor for GCC 7.1.0 and above -#if __GNUC__ > 7 || (__GNUC__ == 7 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 0)) - Struct(const std::tuple<_ValueTypes...>& t) + // Disable constructor if an older then 7.1.0 version of GCC is used +#if !((defined(__GNUC__) || defined(__GNUG__)) && !defined(__clang__) && !(__GNUC__ > 7 || (__GNUC__ == 7 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 0))))) + Struct() = default; + + explicit Struct(const std::tuple<_ValueTypes...>& t) : std::tuple<_ValueTypes...>(t) { }