locked
Compiler error C2666 RRS feed

  • Question

  • Hi

     Why do the compiler emits such C2666 error: I do not see th point

    1>z:\git\itu.osi\cpp\src\iso\itu\osi\als\ssap\prov\provider.cpp(1372): error C2666: 'ALS::SSAP::SERV::SSN::operator ==' : les 2 surcharges ont des conversions similaires 1> z:\git\itu.osi\cpp\src\iso\itu\osi\als\ssap\serv\ssn.h(74): peut être
    'bool ALS::SSAP::SERV::SSN::operator ==(const ALS::SSAP::SERV::SSN &) const'
    1> c:\program files (x86)\windows kits\8.1\include\shared\guiddef.h(192): ou
    'bool operator ==(const GUID &,const GUID &)'
    1> lors de la tentative de mise en correspondance de la liste des arguments '(const ALS::SSAP::SERV::SSN, int)'


    Thank for any help on this C2666.
    Sunday, November 2, 2014 10:00 AM

Answers

  • Hi

     Why do the compiler emits such C2666 error: I do not see th point

    1>z:\git\itu.osi\cpp\src\iso\itu\osi\als\ssap\prov\provider.cpp(1372): error C2666: 'ALS::SSAP::SERV::SSN::operator ==' : les 2 surcharges ont des conversions similaires 1> z:\git\itu.osi\cpp\src\iso\itu\osi\als\ssap\serv\ssn.h(74): peut être
    'bool ALS::SSAP::SERV::SSN::operator ==(const ALS::SSAP::SERV::SSN &) const'
    1> c:\program files (x86)\windows kits\8.1\include\shared\guiddef.h(192): ou
    'bool operator ==(const GUID &,const GUID &)'
    1> lors de la tentative de mise en correspondance de la liste des arguments '(const ALS::SSAP::SERV::SSN, int)'


    Thank for any help on this C2666.

    You should show the code that created this error.

    Did you look up error C2666?

    http://msdn.microsoft.com/en-us/library/dyafzty4.aspx

    But basically, if the compiler cannot decide which function to call, it cannot compile the project.

    Just guessing, but sometimes these ambiguities are caused by having a one-parameter constructor that allows implicit conversions. One-parameter constructors should generally be made explicit. See for example

    http://www.parashift.com/c++-faq/explicit-ctors.html


    David Wilkinson | Visual C++ MVP

    • Marked as answer by Shu 2017 Wednesday, November 19, 2014 1:47 AM
    Sunday, November 2, 2014 11:22 AM