Overload resolution

In order to compile a function call, the compiler must first perform name lookup, which, for functions, may involve argument-dependent lookup, and for function templates may be followed by template argument deduction.

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
CWG 1C++98the behavior was unspecified when the samefunction with possibly different defaultarguments (from different scopes) is selectedthe program is ill-formed in this case
CWG 83C++98the conversion sequence from a string literalto char* was better than that to const char*even though the former is deprecatedthe rank of the deprecatedconversion is lowered (itwas removed in C++11)
CWG 162C++98it was invalid if the overload set named by F containsa non-static member function in the case of &F(args)only invalid if overloadresolution selects a non-staticmember function in this case
CWG 233C++98references and pointers were handled insonsistently inoverloading resolution with user defined conversionsthey are handledconsistently
CWG 280C++98surrogate call functions were not added tothe set of candidate functions for conversionfunctions declared in inaccessible base classesremoved the accessibilityconstraint, the program isill-formed if a surrogate callfunction is selected and thecorresponding conversionfunction cannot be called
CWG 415C++98when a function template is selected as acandidate, its specializations were instantiatedusing template argument deductionno instantiation will occurin this case, their declarationswill be synthesized
CWG 495C++98when the implicit conversions for arguments are equallygood, a non-template conversion function was alwaysbetter than a conversion function template, even if thelatter may have a better standard conversion sequencestandard conversionsequences are comparedbefore specialization levels
CWG 1307C++11overload resolution based on size of arrays was not specifieda shorter array isbetter when possible
CWG 1328C++11the determination of the candidate functions whenbinding a reference to a conversion result was not clearmade clear
CWG 1374C++98qualification conversion was checked before referencebinding when comparing standard conversion sequencesreversed
CWG 1385C++11a non-explicit user-defined conversion function declared witha ref-qualifier did not have a corresponding surrogate functionit has a correspondingsurrogate function
CWG 1467C++11same-type list-initialization ofaggregates and arrays was omittedinitialization defined
CWG 1601C++11conversion from enum to its underlying typedid not prefer the fixed underlying typefixed type is preferredto what it promotes to
CWG 1608C++98the set of member candidates of a unary operator @whose argument has type T1 was empty ifT1 is a class currently being definedthe set is the result ofqualified name lookup ofT1::operator@ in this case
CWG 1687C++98when a built-in candidate is selected by overload resolution,the operands would undergo conversion without restrictiononly convert class type operands,and disabled the secondstandard conversion sequence
CWG 2052C++98ill-formed synthesized function template specializations couldbe added to the candidate set, making the program ill-formedthey are not addedto the candidate set
CWG 2076C++11user-defined conversion is applied to the single initializerin a nested initializer list during list-initializationdue to the resolution of CWG issue 1467not applied
CWG 2137C++11initializer list constructors lost to copyconstructors when list-initializing X from {X}non-aggregates considerinitializer lists first
CWG 2273C++11there was no tiebreaker betweeninherited and non-inherited constructorsnon-inherited constructor wins
CWG 2673C++20built-in candidates with the same parameterlist as a rewritten non-member candidatewere added to the list of built-in candidatesnot added
CWG 2712C++98when a built-in assignment operator is considered,the first parameter could not bound to atemporary, which is already impossible[1]removed theredundant requirement
CWG 2713C++20the conversion restriction regarding designated initializerlists was applied even if the parameter is a referencenot restricted in this case
CWG 2789C++23the explicit object paramaeter was includedwhen comparing parameter-type-listsexcluded
CWG 2856C++11the overload resolution for default-initialization in the contextof copy-list-initialization only considered converting constructorconsiders all constructors
CWG 2919C++98the candidate set of reference initialization by conversiondepended on the target type of the initializationdepends on the targettype of the conversion
P2468R2C++20rewritten candidates based on operator== are addedfor a != b even if a matching operator!= existsnot added

# See also