From Jason Turner

[over.match.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpi_jdczzx/{from.md → to.md} +61 -0
tmp/tmpi_jdczzx/{from.md → to.md} RENAMED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### General <a id="over.match.general">[[over.match.general]]</a>
2
+
3
+ Overload resolution is a mechanism for selecting the best function to
4
+ call given a list of expressions that are to be the arguments of the
5
+ call and a set of *candidate functions* that can be called based on the
6
+ context of the call. The selection criteria for the best function are
7
+ the number of arguments, how well the arguments match the
8
+ parameter-type-list of the candidate function, how well (for non-static
9
+ member functions) the object matches the object parameter, and certain
10
+ other properties of the candidate function.
11
+
12
+ [*Note 1*: The function selected by overload resolution is not
13
+ guaranteed to be appropriate for the context. Other restrictions, such
14
+ as the accessibility of the function, can make its use in the calling
15
+ context ill-formed. — *end note*]
16
+
17
+ Overload resolution selects the function to call in seven distinct
18
+ contexts within the language:
19
+
20
+ - invocation of a function named in the function call syntax
21
+ [[over.call.func]];
22
+ - invocation of a function call operator, a pointer-to-function
23
+ conversion function, a reference-to-pointer-to-function conversion
24
+ function, or a reference-to-function conversion function on a class
25
+ object named in the function call syntax [[over.call.object]];
26
+ - invocation of the operator referenced in an expression
27
+ [[over.match.oper]];
28
+ - invocation of a constructor for default- or direct-initialization
29
+ [[dcl.init]] of a class object [[over.match.ctor]];
30
+ - invocation of a user-defined conversion for copy-initialization
31
+ [[dcl.init]] of a class object [[over.match.copy]];
32
+ - invocation of a conversion function for initialization of an object of
33
+ a non-class type from an expression of class type [[over.match.conv]];
34
+ and
35
+ - invocation of a conversion function for conversion in which a
36
+ reference [[dcl.init.ref]] will be directly bound [[over.match.ref]].
37
+
38
+ Each of these contexts defines the set of candidate functions and the
39
+ list of arguments in its own unique way. But, once the candidate
40
+ functions and argument lists have been identified, the selection of the
41
+ best function is the same in all cases:
42
+
43
+ - First, a subset of the candidate functions (those that have the proper
44
+ number of arguments and meet certain other conditions) is selected to
45
+ form a set of viable functions [[over.match.viable]].
46
+ - Then the best viable function is selected based on the implicit
47
+ conversion sequences [[over.best.ics]] needed to match each argument
48
+ to the corresponding parameter of each viable function.
49
+
50
+ If a best viable function exists and is unique, overload resolution
51
+ succeeds and produces it as the result. Otherwise overload resolution
52
+ fails and the invocation is ill-formed. When overload resolution
53
+ succeeds, and the best viable function is not accessible
54
+ [[class.access]] in the context in which it is used, the program is
55
+ ill-formed.
56
+
57
+ Overload resolution results in a *usable candidate* if overload
58
+ resolution succeeds and the selected candidate is either not a function
59
+ [[over.built]], or is a function that is not deleted and is accessible
60
+ from the context in which overload resolution was performed.
61
+