SergiusTheBest / plog

Portable, simple and extensible C++ logging library
MIT License
2.21k stars 391 forks source link

std::filesystem::path issue with new utf-8 mode on MSVC/Windows #273

Closed macdew closed 1 year ago

macdew commented 1 year ago

I'm trying to upgrade my project from plog 1.1.6 to 1.1.10 and taking advantage of the new PLOG_CHAR_IS_UTF8 mode.

However, I'm having issue with outputting variables of type std::filesystem::path, which aren't being matched. I wonder if this is because, at least on my MSVC, they are natively widestring internally?

Could you double-check if I'm doing something wrong, or whether there is a genuine issue here?

SergiusTheBest commented 1 year ago

Printed characters don't match the actual file path? Or what kind of issue do you have?

macdew commented 1 year ago

Ah, apologies for my poor initial report. The problem is that the code won't compile, with the error being ambiguous overloaded plog::detail::operator <<.

I'm using Visual Studio 2022 (version 17.7.4), compiling with the flag: PLOG_CHAR_IS_UTF8. I'm also compiling with /permissive- and /std:c++17

The full error output for a single std::filesystem::path is as follows:

5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): error C2666: 'plog::detail::operator <<': overloaded functions have similar conversions
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(481,39): message : could be 'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(std::basic_streambuf<char,std::char_traits<char>> *)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(449,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(const void *)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(431,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(long double)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(413,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(double)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(395,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(float)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(377,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(unsigned __int64)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(359,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(__int64)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(341,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(unsigned long)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(323,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(long)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(304,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(unsigned int)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(278,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(int)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(259,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(unsigned short)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(225,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(short)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(207,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(bool)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(201,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(std::ios_base &(__cdecl *)(std::ios_base &))'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(195,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(std::basic_ios<char,std::char_traits<char>> &(__cdecl *)(std::basic_ios<char,std::char_traits<char>> &))'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(190,39): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(std::basic_ostream<char,std::char_traits<char>> &(__cdecl *)(std::basic_ostream<char,std::char_traits<char>> &))'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(144,21): message : or       'void plog::detail::operator <<(plog::util::nostringstream &,const std::string &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(139,21): message : or       'void plog::detail::operator <<(plog::util::nostringstream &,char *)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(118,21): message : or       'void plog::detail::operator <<(plog::util::nostringstream &,const char *)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(112,21): message : or       'void plog::detail::operator <<(plog::util::nostringstream &,const std::wstring &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(107,21): message : or       'void plog::detail::operator <<(plog::util::nostringstream &,wchar_t *)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(92,21): message : or       'void plog::detail::operator <<(plog::util::nostringstream &,const wchar_t *)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\filesystem(1318,52): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::filesystem::operator <<<char,std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,const std::filesystem::path &)'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(476,20): message : or       'std::basic_ostream<char,std::char_traits<char>> &std::basic_ostream<char,std::char_traits<char>>::operator <<(std::nullptr_t)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'std::nullptr_t'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(248,144): message : or       'meta::enableIf<plog::detail::meta::isStreamable<T,std::ostream>::value&&!plog::detail::meta::isStreamable<T,std::wostream>::value,void>::type plog::detail::operator <<(std::wostringstream &,const T &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'initializing': cannot convert from 'plog::util::nostringstream' to 'std::wostringstream &'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(183,60): message : or       'meta::enableIf<plog::detail::meta::isContainer<T>::value&&!plog::detail::meta::isConvertibleToNString<T>::value&&!plog::detail::meta::isConvertibleToString<T>::value&&!plog::detail::meta::isFilesystemPath<T>::value,void>::type plog::detail::operator <<(plog::util::nostringstream &,const T &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : Failed to specialize function template 'meta::enableIf<plog::detail::meta::isContainer<T>::value&&!plog::detail::meta::isConvertibleToNString<T>::value&&!plog::detail::meta::isConvertibleToString<T>::value&&!plog::detail::meta::isFilesystemPath<T>::value,void>::type plog::detail::operator <<(plog::util::nostringstream &,const T &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : With the following template arguments:
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'T=T'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(173,92): message : or       'meta::enableIf<plog::detail::meta::isConvertibleToNString<T>::value,void>::type plog::detail::operator <<(plog::util::nostringstream &,const T &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : Failed to specialize function template 'meta::enableIf<plog::detail::meta::isConvertibleToNString<T>::value,void>::type plog::detail::operator <<(plog::util::nostringstream &,const T &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : With the following template arguments:
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'T=T'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(162,21): message : or       'void plog::detail::operator <<(plog::util::nostringstream &,const std::pair<_Ty1,_Ty2> &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'void plog::detail::operator <<(plog::util::nostringstream &,const std::pair<_Ty1,_Ty2> &)': could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const T'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\cstddef(32,27): message : or       'std::byte std::operator <<(const std::byte,const _IntType) noexcept'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::byte std::operator <<(const std::byte,const _IntType) noexcept': could not deduce template argument for '__formal'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\xstring(1805,32): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string_view<_Elem,_Traits>)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string_view<_Elem,_Traits>)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string_view<_Elem,_Traits>)': could not deduce template argument for 'const std::basic_string_view<_Elem,_Traits>' from 'const T'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\xstring(5185,32): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)': could not deduce template argument for 'const std::basic_string<_Elem,_Traits,_Alloc> &' from 'const T'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\memory(1988,32): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::shared_ptr<_Ty> &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::shared_ptr<_Ty> &)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::shared_ptr<_Ty> &)': could not deduce template argument for 'const std::shared_ptr<_Ty> &' from 'const T'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\memory(3641,32): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::unique_ptr<_Ty2,_Dx2> &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::unique_ptr<_Ty2,_Dx2> &)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::unique_ptr<_Ty2,_Dx2> &)': could not deduce template argument for 'const std::unique_ptr<_Ty2,_Dx2> &' from 'const T'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(687,32): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'const char *'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(731,32): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'char'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(767,31): message : or       'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)': could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'const char *'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(812,31): message : or       'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)': could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'char'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(850,32): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)': could not deduce template argument for 'const _Elem *' from 'const T'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(893,32): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)': template parameter '_Elem' is ambiguous
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : could be 'T'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : or       'char'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)': could not deduce template argument for '_Elem' from 'const T'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(929,31): message : or       'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)': could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'const signed char *'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(935,31): message : or       'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)': could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'signed char'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(940,31): message : or       'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)': could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'const unsigned char *'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(946,31): message : or       'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)': could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'unsigned char'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(1004,9): message : or       '_Ostr &&std::operator <<(_Ostr &&,const _Ty &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : '_Ostr &&std::operator <<(_Ostr &&,const _Ty &)': could not deduce template argument for '__formal'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\ostream(1081,32): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::error_code &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::error_code &)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'const std::error_code &'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : Reason: cannot convert from 'const T' to 'const std::error_code'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\regex(985,32): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::sub_match<_BidIt> &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::sub_match<_BidIt> &)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::sub_match<_BidIt> &)': could not deduce template argument for 'const std::sub_match<_BidIt> &' from 'const T'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\thread(225,37): message : or       'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,std::thread::id)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,std::thread::id)': could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : 'initializing': cannot convert from 'const T' to 'std::thread::id'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,26): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\valarray(784,26): message : or       'std::valarray<_Ty> std::operator <<(const std::valarray<_Ty> &,const valarray<_Ty>::value_type &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::valarray<_Ty> std::operator <<(const std::valarray<_Ty> &,const valarray<_Ty>::value_type &)': could not deduce template argument for 'const std::valarray<_Ty> &' from 'plog::util::nostringstream'
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\valarray(794,26): message : or       'std::valarray<_Ty> std::operator <<(const valarray<_Ty>::value_type &,const std::valarray<_Ty> &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::valarray<_Ty> std::operator <<(const valarray<_Ty>::value_type &,const std::valarray<_Ty> &)': could not deduce template argument for 'const std::valarray<_Ty> &' from 'const T'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include\valarray(944,26): message : or       'std::valarray<_Ty> std::operator <<(const std::valarray<_Ty> &,const std::valarray<_Ty> &)'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : 'std::valarray<_Ty> std::operator <<(const std::valarray<_Ty> &,const std::valarray<_Ty> &)': could not deduce template argument for 'const std::valarray<_Ty> &' from 'plog::util::nostringstream'
5>C:\.conan\data\plog\1.1.10\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\include\plog\Record.h(324,13): message : while trying to match the argument list '(plog::util::nostringstream, const T)'
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
5>C:\git\...: message : see reference to function template instantiation 'plog::Record &plog::Record::operator <<<std::filesystem::path>(const T &)' being compiled
5>        with
5>        [
5>            T=std::filesystem::path
5>        ]
SergiusTheBest commented 1 year ago

Ok, thank you! Let me check that.

macdew commented 1 year ago

Thanks Sergey! It could definitely be user error, but for now I'm solving it by just making all the logged paths call u8string() so that's an easy workaround.

SergiusTheBest commented 1 year ago

Fixed the issue and added the corresponding test.