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)
- mpd changes permissions/owner for file on write HOT 2
- macOS: after sleep, awaken, and spending the buffer, MPD needs play to resume URL HOT 2
- httpd doesnt work anymore - mpd 0.22.6 - debian 11 HOT 3
- albumart is returning "Access denied" HOT 6
- Cant get MPD working (mpd trys to use audio output that isnt in the config file) HOT 2
- in Windows 11 Failed to configure output in line 21; device "Realtek High Definition Audio" is not found HOT 3
- Favorites (Loved) tracks HOT 2
- Is it possible to expose a plugin interface that allows for dynamic song search from remote services? HOT 1
- Distortion of high frequency (>10kHz) sound HOT 1
- MPD produces distorted output at high frequencies HOT 3
- Improvement to documentation: How do you use cue files? HOT 6
- Cue file does not create virtual directory HOT 2
- Unrecognized single mode HOT 2
- mdp randomly unable to play music – macOS M1 ; ncmpcpp/MPDroid clients HOT 2
- Added mpd and ncmpcpp via pacman and everything was great for several days but now broken HOT 7
- Assert on attempt to play 6 channel dsf file on stereo DAC HOT 4
- DSD content in wavpack plays as PCM on DSD capable DACs HOT 4
- Volume n/a HOT 2
- Only with mpg123 decoder, there is no audio glitch after playback of certain mp3 files. HOT 1
- How to correctly listen .pls playlists? HOT 5
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.