You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test.cpp: In function 'bool f(char*)':
test.cpp:7:40: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
7 | return std::string("a-str") == arg;
| ^~~
In file included from /usr/include/c++/12.2/string:53,
from test.cpp:1:
/usr/include/c++/12.2/bits/basic_string.h:3599:5: note: candidate 1: 'bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*) [with _CharT = char; _Traits = char_traits; _Alloc = allocator]'
3599 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
In file included from /usr/include/boost/filesystem.hpp:16,
from test.cpp:2:
/usr/include/boost/filesystem/path.hpp:1294:9: note: candidate 2: 'typename boost::enable_if_c<boost::filesystem::detail::path_traits::is_convertible_to_path_source<typename boost::remove_cv::type>::value, bool>::type boost::filesystem::operator==(const path&, const Source&) [with Source = char*; typename boost::enable_if_c<detail::path_traits::is_convertible_to_path_source<typename boost::remove_cv::type>::value, bool>::type = bool; typename boost::remove_cv::type = char*]'
1294 | >::type operator==(path const& lhs, Source const& rhs)
| ^~~~~~~~
clang++ reports:
test.cpp:7:30: error: use of overloaded operator '==' is ambiguous (with operand types 'std::string' (aka 'basic_string') and 'char *')
return std::string("a-str") == arg;
~~~~~~~~~~~~~~~~~~~~ ^ ~~~
/usr/bin/../lib64/gcc/x86_64-linux-gnu/12.2/../../../../include/c++/12.2/bits/basic_string.h:3599:5: note: candidate function [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]
operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
^
/usr/include/boost/filesystem/path.hpp:1294:9: note: candidate function [with Source = char *]
…std lib.
Path comparison operators that accept arbitrary path source types now require
the other argument to be exactly path. This prevents the compiler from picking
those operators when the other argument is convertible to path. This can happen
even when neither of the arguments are actually paths, e.g. when the
comparison operators are brought into the current scope by a using directive.
Fixes#285.
…std lib.
Path comparison operators that accept arbitrary path source types now require
the other argument to be exactly path. This prevents the compiler from picking
those operators when the other argument is convertible to path. This can happen
even when neither of the arguments are actually paths, e.g. when the
comparison operators are brought into the current scope by a using directive.
Fixes#285.
Not sure if I should this issue should be reported here or reported to the other upstream, but this short example is failed to be compiled:
GNU's
g++
reports:clang++
reports:The text was updated successfully, but these errors were encountered: