Skip to content

MSVC 19 C2666 error: 'toml::v2::operator ==': 2 overloads have similar conversions #56

@HellsingDarge

Description

@HellsingDarge

Environment

Compiler: MSVS 19

C++ standard mode: 17

Target arch: x64

Library configuration overrides: None

Describe the bug

Trying to compile library using tomlplusplus v2.1.0 causes c2666 to appear:

Multiple headers
toml++\toml_value.h(439): error C2666: 'toml::v2::operator ==': 2 overloads have similar conversions
toml++\toml_table.hpp(283): note: could be 'bool toml::v2::operator ==(const toml::v2::table &,const toml::v2::table &) noexcept' [found using argument-dependent lookup]
toml++\toml_array.hpp(206): note: or       'bool toml::v2::operator ==(const toml::v2::array &,const toml::v2::array &) noexcept' [found using argument-dependent lookup]
MSVC\14.27.29110\include\exception(267): note: or       'bool std::operator ==(const std::exception_ptr &,const std::exception_ptr &) noexcept' [found using argument-dependent lookup]
MSVC\14.27.29110\include\exception(271): note: or       'bool std::operator ==(std::nullptr_t,const std::exception_ptr &) noexcept' [found using argument-dependent lookup]
MSVC\14.27.29110\include\exception(275): note: or       'bool std::operator ==(const std::exception_ptr &,std::nullptr_t) noexcept' [found using argument-dependent lookup]
MSVC\14.27.29110\include\system_error(168): note: or       'bool std::operator ==(const std::error_code &,const std::error_code &) noexcept' [found using argument-dependent lookup]
MSVC\14.27.29110\include\system_error(172): note: or       'bool std::operator ==(const std::error_code &,const std::error_condition &) noexcept' [found using argument-dependent lookup]
MSVC\14.27.29110\include\system_error(176): note: or       'bool std::operator ==(const std::error_condition &,const std::error_code &) noexcept' [found using argument-dependent lookup]
MSVC\14.27.29110\include\system_error(248): note: or       'bool std::operator ==(const std::error_condition &,const std::error_condition &) noexcept' [found using argument-dependent lookup]
MSVC\14.27.29110\include\thread(204): note: or       'bool std::operator ==(std::thread::id,std::thread::id) noexcept' [found using argument-dependent lookup]
toml++\toml_common.h(768): note: or       'bool toml::v2::sf::operator ==(const toml::v2::sf::source_position &,const toml::v2::sf::source_position &) noexcept' [found using argument-dependent lookup]
toml++\toml_date_time.h(23): note: or       'bool toml::v2::operator ==(toml::v2::date,toml::v2::date) noexcept' [found using argument-dependent lookup]
toml++\toml_date_time.h(113): note: or       'bool toml::v2::operator ==(const toml::v2::time &,const toml::v2::time &) noexcept' [found using argument-dependent lookup]
toml++\toml_date_time.h(230): note: or       'bool toml::v2::operator ==(toml::v2::time_offset,toml::v2::time_offset) noexcept' [found using argument-dependent lookup]
toml++\toml_date_time.h(350): note: or       'bool toml::v2::stdopt::operator ==(const toml::v2::stdopt::date_time &,const toml::v2::stdopt::date_time &) noexcept' [found using argument-dependent lookup]
toml++\toml_node_view.h(451): note: or       'bool toml::v2::node_view<toml::v2::node>::operator ==(const toml::v2::node_view<toml::v2::node> &,const toml::v2::table &) noexcept' [found using argument-dependent lookup]
toml++\toml_node_view.h(458): note: or       'bool toml::v2::node_view<toml::v2::node>::operator ==(const toml::v2::table &,const toml::v2::node_view<toml::v2::node> &) noexcept' [found using argument-dependent lookup]
toml++\toml_node_view.h(462): note: or       'bool toml::v2::node_view<toml::v2::node>::operator ==(const toml::v2::node_view<toml::v2::node> &,const toml::v2::array &) noexcept' [found using argument-dependent lookup]
toml++\toml_node_view.h(469): note: or       'bool toml::v2::node_view<toml::v2::node>::operator ==(const toml::v2::array &,const toml::v2::node_view<toml::v2::node> &) noexcept' [found using argument-dependent lookup]
toml++\toml_node_view.h(451): note: or       'bool toml::v2::node_view<const toml::v2::node>::operator ==(const toml::v2::node_view<const toml::v2::node> &,const toml::v2::table &) noexcept' [found using argument-dependent lookup]
toml++\toml_node_view.h(458): note: or       'bool toml::v2::node_view<const toml::v2::node>::operator ==(const toml::v2::table &,const toml::v2::node_view<const toml::v2::node> &) noexcept' [found using argument-dependent lookup]
toml++\toml_node_view.h(462): note: or       'bool toml::v2::node_view<const toml::v2::node>::operator ==(const toml::v2::node_view<const toml::v2::node> &,const toml::v2::array &) noexcept' [found using argument-dependent lookup]
toml++\toml_node_view.h(469): note: or       'bool toml::v2::node_view<const toml::v2::node>::operator ==(const toml::v2::array &,const toml::v2::node_view<const toml::v2::node> &) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(395): note: or       'bool toml::v2::value<std::string>::operator ==(const toml::v2::value<std::string> &,std::basic_string_view<char,std::char_traits<char>>) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(408): note: or       'bool toml::v2::value<std::string>::operator ==(std::basic_string_view<char,std::char_traits<char>>,const toml::v2::value<std::string> &) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(395): note: or       'bool toml::v2::value<int64_t>::operator ==(const toml::v2::value<int64_t> &,__int64) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(408): note: or       'bool toml::v2::value<int64_t>::operator ==(__int64,const toml::v2::value<int64_t> &) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(395): note: or       'bool toml::v2::value<double>::operator ==(const toml::v2::value<double> &,double) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(408): note: or       'bool toml::v2::value<double>::operator ==(double,const toml::v2::value<double> &) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(395): note: or       'bool toml::v2::value<bool>::operator ==(const toml::v2::value<bool> &,bool) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(408): note: or       'bool toml::v2::value<bool>::operator ==(bool,const toml::v2::value<bool> &) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(395): note: or       'bool toml::v2::value<toml::v2::date>::operator ==(const toml::v2::value<toml::v2::date> &,const toml::v2::date &) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(408): note: or       'bool toml::v2::value<toml::v2::date>::operator ==(const toml::v2::date &,const toml::v2::value<toml::v2::date> &) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(395): note: or       'bool toml::v2::value<toml::v2::time>::operator ==(const toml::v2::value<toml::v2::time> &,const toml::v2::time &) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(408): note: or       'bool toml::v2::value<toml::v2::time>::operator ==(const toml::v2::time &,const toml::v2::value<toml::v2::time> &) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(395): note: or       'bool toml::v2::value<toml::v2::stdopt::date_time>::operator ==(const toml::v2::value<toml::v2::stdopt::date_time> &,const toml::v2::stdopt::date_time &) noexcept' [found using argument-dependent lookup]
toml++\toml_value.h(408): note: or       'bool toml::v2::value<toml::v2::stdopt::date_time>::operator ==(const toml::v2::stdopt::date_time &,const toml::v2::value<toml::v2::stdopt::date_time> &) noexcept' [found using argument-dependent lookup]
toml++\toml_node_view.h(481): note: or       'bool toml::v2::operator ==<std::string>(const toml::v2::value<std::string> &,const toml::v2::node_view<toml::v2::node> &) noexcept'
toml++\toml_node_view.h(489): note: or       'bool toml::v2::operator ==<ValueType,void>(const toml::v2::node_view<toml::v2::node> &,const T &) noexcept'
        with
        [
            ValueType=std::string,
            T=std::string
        ]
toml++\toml_node_view.h(481): note: or       'bool toml::v2::operator ==<std::string>(const toml::v2::value<std::string> &,const toml::v2::node_view<const toml::v2::node> &) noexcept'
toml++\toml_node_view.h(489): note: or       'bool toml::v2::operator ==<ValueType,void>(const toml::v2::node_view<const toml::v2::node> &,const T &) noexcept'
        with
        [
            ValueType=std::string,
            T=std::string
        ]
toml++\toml_value.h(439): note: while trying to match the argument list '(const toml::v2::value<std::string>, const ValueType)'
        with
        [
            ValueType=std::string
        ]
toml++\toml_array.hpp(222): note: see reference to function template instantiation 'bool toml::v2::operator ==<std::string>(const toml::v2::value<std::string> &,const toml::v2::value<std::string> &) noexcept' being compiled
toml++\toml_array.hpp(222): note: see reference to function template instantiation 'bool toml::v2::operator ==<std::string>(const toml::v2::value<std::string> &,const toml::v2::value<std::string> &) noexcept' being compiled
MSVC\14.27.29110\include\type_traits(1504): note: see reference to function template instantiation 'bool toml::v2::==::<lambda_e9cfa60f6d06c6107cbd5e52f5b441a6>::operator ()<toml::v2::value<std::string>>(const toml::v2::value<std::string> &) noexcept const' being compiled
MSVC\14.27.29110\include\type_traits(1748): note: see reference to alias template instantiation 'std::_Decltype_invoke_nonzero<toml::v2::==::<lambda_e9cfa60f6d06c6107cbd5e52f5b441a6>&&,toml::v2::value<std::string>&,>' being compiled
toml++\toml_node.h(553): note: see reference to variable template 'const bool is_invocable_v<<lambda_e9cfa60f6d06c6107cbd5e52f5b441a6> &&,toml::v2::value<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > &>' being compiled
toml++\toml_node.h(581): note: see reference to variable template 'const bool toml::v2::node::can_visit<<lambda_e9cfa60f6d06c6107cbd5e52f5b441a6> &&,toml::v2::node &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >' being compiled
toml++\toml_node.h(588): note: see reference to variable template 'const bool toml::v2::node::visit_is_nothrow_one<<lambda_e9cfa60f6d06c6107cbd5e52f5b441a6> &&,toml::v2::node &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >' being compiled
toml++\toml_node.h(755): note: see reference to variable template 'const bool toml::v2::node::visit_is_nothrow<<lambda_e9cfa60f6d06c6107cbd5e52f5b441a6> &&,toml::v2::node &>' being compiled
toml++\toml_node.h(754): note: while compiling class template member function 'bool toml::v2::node::visit<toml::v2::==::<lambda_e9cfa60f6d06c6107cbd5e52f5b441a6>>(Func &&) noexcept &'
        with
        [
            Func=toml::v2::==::<lambda_e9cfa60f6d06c6107cbd5e52f5b441a6>
        ]
Single header (similar message)
toml.hpp(2848): error C2666: 'toml::v2::operator ==': 2 overloads have similar conversions
toml.hpp(8031): note: could be 'bool toml::v2::operator ==(const toml::v2::table &,const toml::v2::table &) noexcept' [found using argument-dependent lookup]
toml.hpp(7644): note: or       'bool toml::v2::operator ==(const toml::v2::array &,const toml::v2::array &) noexcept' [found using argument-dependent lookup]
[snip]

Works fine in v2.0.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions