boost::core::string_view gives ambiguous error
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start with the reproducer in the issue and inspect boost/core/detail/string_view.hpp, comparing the Boost 1.75 and 1.84 behavior around BOOST_BEAST_USE_STD_STRING_VIEW. Run the provided GCC 13.2 example to confirm the ambiguous constructor error. Done means the reported string_view construction is no longer ambiguous while preserving the relevant existing behavior, with a regression test covering the example.
Written by the indexing model from the issue text.
Description
(1.84 gcc 13.2)
upgrading boost from 1.75 to 1.84 breaks existing code that boils down to:
#include <boost/core/detail/string_view.hpp>
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
<source>: In function 'int main()':
<source>:11:39: error: call of overloaded 'Foo(<brace-enclosed initializer list>)' is ambiguous
11 | Foo{boost::core::string_view()};
| ^
<source>:6:9: note: candidate: 'Foo::Foo(const std::string&)'
6 | Foo(const std::string& f) {}
| ^~~
<source>: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?
- Dominant language
- C++
- Stars
- 156
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/core
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
Difficulty 1/5 Under an hour Newbie friendliness 55/100
-
saturate_cast Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100