boost::core::string_view gives ambiguous error
- Lingua principale
- C++
- Stelle
- 156
- Fork
- 116
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
(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?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia con il reproducer nell’issue ed esamina boost/core/detail/string_view.hpp, confrontando il comportamento di Boost 1.75 e 1.84 relativo a BOOST_BEAST_USE_STD_STRING_VIEW. Esegui l’esempio fornito con GCC 13.2 per confermare l’errore del costruttore ambiguo. Il lavoro è completato quando la costruzione di string_view segnalata non è più ambigua, preservando il comportamento esistente pertinente, con un test di regressione che copra l’esempio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100