boostorg / boostorg/core

boost::core::string_view gives ambiguous error

Open
#167 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
156
Forks
116
PR merge metrics
No merged PRs in 30d

Description

(1.84 gcc 13.2)

upgrading boost from 1.75 to 1.84 breaks existing code that boils down to:

````c++
#include

struct Foo
{
Foo(std::string_view f) {}
Foo(const std::string& f) {}
};

int main() {
Foo{std::string_view()}; // works
Foo{boost::core::string_view()}; // fails

//Foo{boost::beast::http::fields{}.find("")->value()}; // same failure, works in 1.75
}
````
https://godbolt.org/z/8TKfP6Pj8

```
: In function 'int main()':
:11:39: error: call of overloaded 'Foo()' is ambiguous
11 | Foo{boost::core::string_view()};
| ^
:6:9: note: candidate: 'Foo::Foo(const std::string&)'
6 | Foo(const std::string& f) {}
| ^~~
:5:9: note: candidate: 'Foo::Foo(std::string_view)'
5 | Foo(std::string_view f) {}
| ^~~
Compiler returned: 1
```

it _used_ to work with `BOOST_BEAST_USE_STD_STRING_VIEW`. how do I get it to use `std::string_view` like before?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.