Comments (4)
What code location does it complain about?
from mpd.
from mpd.
I don't see where the code asks the compiler to convert a string_view to a string - do you?
from mpd.
I'm suspecting this may have to do with the clang version and that mine was a few versions old.
I went ahead and downloaded the latest xcode command-line tools and installed, and the error went away.
Using clang/llvm version 12 though, I do get the error - and wth clang/llvm version 13, I don't.
Using this minimal example:
#include <string>
#include <set>
#include <string_view>
bool SetContains(const std::set<std::string, std::less<>> &set, const std::string_view &key) {
return set.contains(key);
}
Using clang-12:
% /usr/local/opt/llvm@12/bin/clang++ -std=c++20 -c test.cpp
test.cpp:7:25: error: no viable conversion from 'const std::string_view' (aka 'const basic_string_view<char>') to 'const std::set<std::string, std::less<>>::key_type' (aka 'const std::string')
return set.contains(key);
^~~
/usr/local/opt/llvm@12/bin/../include/c++/v1/string:821:5: note: candidate constructor not viable: no known conversion from 'const std::string_view' (aka 'const basic_string_view<char>') to 'const std::string &' for 1st argument
basic_string(const basic_string& __str);
^
/usr/local/opt/llvm@12/bin/../include/c++/v1/string:826:5: note: candidate constructor not viable: no known conversion from 'const std::string_view' (aka 'const basic_string_view<char>') to 'std::string &&' for 1st argument
basic_string(basic_string&& __str)
^
/usr/local/opt/llvm@12/bin/../include/c++/v1/string:839:5: note: candidate constructor template not viable: no known conversion from 'const std::string_view' (aka 'const basic_string_view<char>') to 'const char *' for 1st argument
basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) {
^
/usr/local/opt/llvm@12/bin/../include/c++/v1/string:890:5: note: candidate constructor not viable: no known conversion from 'const std::string_view' (aka 'const basic_string_view<char>') to 'initializer_list<char>' for 1st argument
basic_string(initializer_list<_CharT> __il);
^
/usr/local/opt/llvm@12/bin/../include/c++/v1/string:814:40: note: explicit constructor is not a candidate
_LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a)
^
/usr/local/opt/llvm@12/bin/../include/c++/v1/string:876:18: note: explicit constructor is not a candidate
explicit basic_string(const _Tp& __t);
^
/usr/local/opt/llvm@12/bin/../include/c++/v1/set:797:35: note: passing argument to parameter '__k' here
bool contains(const key_type& __k) const {return find(__k) != end();}
^
1 error generated.
My guess is the following is occurring, though I now wonder if this is a compiler bug?
So here:
MPD/src/decoder/DecoderPlugin.hxx
Line 43 in 45f81cd
The function suffixes_function()
is declared to return std::set<std::string, std::less<>>
Then here:
MPD/src/decoder/DecoderPlugin.cxx
Line 25 in 45f81cd
SetContains
is declared as a function that accept (const auto &set, const auto &key)
Looking at
MPD/src/decoder/DecoderPlugin.cxx
Line 37 in 45f81cd
since the suffix
parameter is a string_view
, and the suffixes_function
returns a std::set<std::string, std::less<>>
, the call to SetContains
is essentially now SetContains(const std::set<std::string, std::less<>> &set, const std::string_view &key)
And apparently this out-of-date clang version I had considers that an error.
I'm guessing this can be closed since the fix is to just update to a newer clang, sorry for the noise.
from mpd.
Related Issues (20)
- NetEase cloud music(V9.0.60.201911) upnp push mpd+upmpdcli tear sound HOT 1
- musicpd.org HTTPS certificate is expired HOT 1
- mpd 0.24 (0.23.15) will not play via icecast as a drop-in replacement f/0.23.14 - mpd hangs until SIGTERM HOT 1
- Add commands to protocol to align with Mpc's Capabilities HOT 19
- NetEase cloud music upnp mpd+upmpdcli tear sound HOT 6
- MPD satellite mode with NFSv4 does not work HOT 1
- [Feature request] Satellite mode with NFSv4 HOT 7
- Satellite mode with NFSv3 server and "version=4" argument results in crash
- Satellite mode with NFSv4 server results in infinite loop HOT 5
- build: --prefix install location HOT 3
- Ubuntu 24.04 mpd: error while loading shared libraries: libfmt.so.8: cannot open shared object file: No such file or directory HOT 10
- mp3 files are played completely noisy HOT 2
- Crossfade noise on line out with FLAC files HOT 2
- openwrt安装mpd和upmpdcli,重启后不能运行 HOT 1
- When unpausing, there is a 1 second delay before audio resumes with fifo visualizer HOT 2
- Support CD De-emphasis HOT 2
- Better Opus ReplayGain support HOT 2
- Embedded art messes with bitrate estimation which seems to mess with mpd's seeking ability
- Tags MUSICBRAINZ_WORKID and MUSICBRAINZ_RELEASEGROUPID are not working
- Streams opend with mpg123 plugin have invalid duration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mpd.