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.
This commit is contained in:
patrick96 2020-12-12 00:20:04 +01:00 committed by Patrick Ziegler
parent a45b5d0424
commit 54e2490aa5
2 changed files with 5 additions and 0 deletions

View File

@ -100,6 +100,7 @@ class logger {
/** /**
* Convert string * Convert string
*/ */
const char* convert(string& arg) const;
const char* convert(const string& arg) const; const char* convert(const string& arg) const;
/** /**

View File

@ -13,6 +13,10 @@ POLYBAR_NS
/** /**
* Convert string * Convert string
*/ */
const char* logger::convert(string& arg) const {
return arg.c_str();
}
const char* logger::convert(const string& arg) const { const char* logger::convert(const string& arg) const {
return arg.c_str(); return arg.c_str();
} }