From 54e2490aa5e1429329ef340347c56f8904bc60b2 Mon Sep 17 00:00:00 2001 From: patrick96 Date: Sat, 12 Dec 2020 00:20:04 +0100 Subject: [PATCH] fix(logger): Wrong conversion function called For some reason when passing some non-const strings to convert, the convert(T&& arg) method was used instead of the one specialized for strings. This caused an error in clang because you can't pass objects with non-trivial types to varargs functions. The best solution I found was to just add a specialized function for non-const strings. --- include/components/logger.hpp | 1 + src/components/logger.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/components/logger.hpp b/include/components/logger.hpp index 0d270927..6d995072 100644 --- a/include/components/logger.hpp +++ b/include/components/logger.hpp @@ -100,6 +100,7 @@ class logger { /** * Convert string */ + const char* convert(string& arg) const; const char* convert(const string& arg) const; /** diff --git a/src/components/logger.cpp b/src/components/logger.cpp index f1e968c8..f5151799 100644 --- a/src/components/logger.cpp +++ b/src/components/logger.cpp @@ -13,6 +13,10 @@ POLYBAR_NS /** * Convert string */ +const char* logger::convert(string& arg) const { + return arg.c_str(); +} + const char* logger::convert(const string& arg) const { return arg.c_str(); }