From Jason Turner

[over]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpp_vkuzje/{from.md → to.md} +219 -123
tmp/tmpp_vkuzje/{from.md → to.md} RENAMED
@@ -377,10 +377,14 @@ handled as candidate functions in the usual way.[^2] A given name can
377
  refer to one or more function templates and also to a set of overloaded
378
  non-template functions. In such a case, the candidate functions
379
  generated from each function template are combined with the set of
380
  non-template candidate functions.
381
 
 
 
 
 
382
  #### Function call syntax <a id="over.match.call">[[over.match.call]]</a>
383
 
384
  In a function call ([[expr.call]])
385
 
386
  ``` bnf
@@ -463,11 +467,11 @@ operators of `T` are obtained by ordinary lookup of the name
463
 
464
  In addition, for each non-explicit conversion function declared in `T`
465
  of the form
466
 
467
  ``` bnf
468
- 'operator' conversion-type-id '( )' attribute-specifier-seqₒₚₜ cv-qualifier ';'
469
  ```
470
 
471
  where *cv-qualifier* is the same cv-qualification as, or a greater
472
  cv-qualification than, *cv*, and where *conversion-type-id* denotes the
473
  type “pointer to function of (`P1`,...,`Pn)` returning `R`”, or the type
@@ -537,13 +541,13 @@ struct String {
537
  };
538
  String operator + (const String&, const String&);
539
 
540
  void f(void) {
541
  const char* p= "one" + "two"; // ill-formed because neither
542
- // operand has user-defined type
543
  int I = 1 + 1; // Always evaluates to 2 even if
544
- // user-defined types exist which
545
  // would perform the operation.
546
  }
547
  ```
548
 
549
  If either operand has a type that is a class or an enumeration, a
@@ -574,13 +578,14 @@ version is `T1`, and for a binary operator `@` with a left operand of a
574
  type whose cv-unqualified version is `T1` and a right operand of a type
575
  whose cv-unqualified version is `T2`, three sets of candidate functions,
576
  designated *member candidates*, *non-member candidates* and *built-in
577
  candidates*, are constructed as follows:
578
 
579
- - If `T1` is a complete class type, the set of member candidates is the
580
- result of the qualified lookup of `T1::operator@` (
581
- [[over.call.func]]); otherwise, the set of member candidates is empty.
 
582
  - The set of non-member candidates is the result of the unqualified
583
  lookup of `operator@` in the context of the expression according to
584
  the usual rules for name lookup in unqualified function calls (
585
  [[basic.lookup.argdep]]) except that all member functions are ignored.
586
  However, if no operand has a class type, only those non-member
@@ -595,12 +600,12 @@ candidates*, are constructed as follows:
595
  defined in  [[over.built]] that, compared to the given operator,
596
  - have the same operator name, and
597
  - accept the same number of operands, and
598
  - accept operand types to which the given operand or operands can be
599
  converted according to [[over.best.ics]], and
600
- - do not have the same parameter-type-list as any non-template
601
- non-member candidate.
602
 
603
  For the built-in assignment operators, conversions of the left operand
604
  are restricted as follows:
605
 
606
  - no temporaries are introduced to hold the left operand, and
@@ -626,15 +631,30 @@ void m() {
626
  a + b; // operator+(a,b) chosen over int(a) + int(b)
627
  }
628
  ```
629
 
630
  If a built-in candidate is selected by overload resolution, the operands
631
- are converted to the types of the corresponding parameters of the
632
- selected operation function. Then the operator is treated as the
 
 
633
  corresponding built-in operator and interpreted according to Clause 
634
  [[expr]].
635
 
 
 
 
 
 
 
 
 
 
 
 
 
 
636
  The second operand of operator `->` is ignored in selecting an
637
  `operator->` function, and is not an argument when the `operator->`
638
  function is called. When `operator->` returns, the operator `->` is
639
  applied to the value returned, with the original second operand.[^7]
640
 
@@ -679,29 +699,32 @@ the candidate functions are all the converting constructors (
679
 
680
  Under the conditions specified in  [[dcl.init]], as part of a
681
  copy-initialization of an object of class type, a user-defined
682
  conversion can be invoked to convert an initializer expression to the
683
  type of the object being initialized. Overload resolution is used to
684
- select the user-defined conversion to be invoked. Assuming that “*cv1*
685
- `T`” is the type of the object being initialized, with `T` a class type,
686
- the candidate functions are selected as follows:
 
 
 
687
 
688
  - The converting constructors ([[class.conv.ctor]]) of `T` are
689
  candidate functions.
690
  - When the type of the initializer expression is a class type “*cv*
691
  `S`”, the non-explicit conversion functions of `S` and its base
692
  classes are considered. When initializing a temporary to be bound to
693
  the first parameter of a constructor that takes a reference to
694
  possibly cv-qualified `T` as its first argument, called with a single
695
- argument in the context of direct-initialization, explicit conversion
696
- functions are also considered. Those that are not hidden within `S`
697
- and yield a type whose cv-unqualified version is the same type as `T`
698
- or is a derived class thereof are candidate functions. Conversion
699
- functions that return “reference to `X`” return lvalues or xvalues,
700
- depending on the type of reference, of type `X` and are therefore
701
- considered to yield `X` for this process of selecting candidate
702
- functions.
703
 
704
  In both cases, the argument list has one argument, which is the
705
  initializer expression. This argument will be compared against the first
706
  parameter of the constructors and against the implicit object parameter
707
  of the conversion functions.
@@ -744,18 +767,23 @@ applying a conversion function to an initializer expression. Overload
744
  resolution is used to select the conversion function to be invoked.
745
  Assuming that “*cv1* `T`” is the underlying type of the reference being
746
  initialized, and “*cv* `S`” is the type of the initializer expression,
747
  with `S` a class type, the candidate functions are selected as follows:
748
 
749
- - The conversion functions of `S` and its base classes are considered,
750
- except that for copy-initialization, only the non-explicit conversion
751
- functions are considered. Those that are not hidden within `S` and
752
- yield type “lvalue reference to *cv2* `T2`” (when [[dcl.init.ref]]
753
- requires an lvalue result) or “ `T2`” or rvalue reference to `T2`”
754
- (when [[dcl.init.ref]] requires an rvalue result), where “*cv1* `T`”
755
- is reference-compatible ([[dcl.init.ref]]) with “*cv2* `T2`”, are
756
- candidate functions.
 
 
 
 
 
757
 
758
  The argument list has one argument, which is the initializer expression.
759
  This argument will be compared against the implicit object parameter of
760
  the conversion functions.
761
 
@@ -855,12 +883,29 @@ and then
855
  float x = a; // ambiguous: both possibilities require conversions,
856
  // and neither is better than the other
857
  ```
858
 
859
  or, if not that,
860
- - `F1` is a non-template function and `F2` is a function template
861
- specialization, or, if not that,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
862
  - `F1` and `F2` are function template specializations, and the function
863
  template for `F1` is more specialized than the template for `F2`
864
  according to the partial ordering rules described in 
865
  [[temp.func.order]].
866
 
@@ -937,20 +982,41 @@ forms:
937
 
938
  - a *standard conversion sequence* ([[over.ics.scs]]),
939
  - a *user-defined conversion sequence* ([[over.ics.user]]), or
940
  - an *ellipsis conversion sequence* ([[over.ics.ellipsis]]).
941
 
942
- However, when considering the argument of a constructor or user-defined
943
- conversion function that is a candidate by  [[over.match.ctor]] when
944
- invoked for the copying/moving of the temporary in the second step of a
945
- class copy-initialization, by  [[over.match.list]] when passing the
946
- initializer list as a single argument or when the initializer list has
947
- exactly one element and a conversion to some class `X` or reference to
948
- (possibly cv-qualified) `X` is considered for the first parameter of a
949
- constructor of `X`, or by  [[over.match.copy]], [[over.match.conv]], or
950
- [[over.match.ref]] in all cases, only standard conversion sequences and
951
- ellipsis conversion sequences are considered.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
952
 
953
  For the case where the parameter type is a reference, see 
954
  [[over.ics.ref]].
955
 
956
  When the parameter type is not a reference, the implicit conversion
@@ -1068,12 +1134,12 @@ conversion function template, the second standard conversion sequence
1068
  shall have exact match rank.
1069
 
1070
  A conversion of an expression of class type to the same class type is
1071
  given Exact Match rank, and a conversion of an expression of class type
1072
  to a base class of that type is given Conversion rank, in spite of the
1073
- fact that a copy/move constructor (i.e., a user-defined conversion
1074
- function) is called for those cases.
1075
 
1076
  ##### Ellipsis conversion sequences <a id="over.ics.ellipsis">[[over.ics.ellipsis]]</a>
1077
 
1078
  An ellipsis conversion sequence occurs when an argument in a function
1079
  call is matched with the ellipsis parameter specification of the
@@ -1131,29 +1197,27 @@ formation of implicit conversion sequences treats the `int` bit-field as
1131
  an `int` lvalue and finds an exact match with the parameter. If the
1132
  function is selected by overload resolution, the call will nonetheless
1133
  be ill-formed because of the prohibition on binding a non-`const` lvalue
1134
  reference to a bit-field ([[dcl.init.ref]]).
1135
 
1136
- The binding of a reference to an expression that is
1137
- *reference-compatible with added qualification* influences the rank of a
1138
- standard conversion; see  [[over.ics.rank]] and  [[dcl.init.ref]].
1139
-
1140
  ##### List-initialization sequence <a id="over.ics.list">[[over.ics.list]]</a>
1141
 
1142
  When an argument is an initializer list ([[dcl.init.list]]), it is not
1143
  an expression and special rules apply for converting it to a parameter
1144
  type.
1145
 
1146
- If the parameter type is `std::initializer_list<X>` or “array of
1147
- `X`”[^12] and all the elements of the initializer list can be implicitly
1148
- converted to `X`, the implicit conversion sequence is the worst
1149
- conversion necessary to convert an element of the list to `X`. This
1150
- conversion can be a user-defined conversion even in the context of a
1151
- call to an initializer-list constructor.
 
1152
 
1153
  ``` cpp
1154
  void f(std::initializer_list<int>);
 
1155
  f( {1,2,3} ); // OK: f(initializer_list<int>) identity conversion
1156
  f( {'a','b'} ); // OK: f(initializer_list<int>) integral promotion
1157
  f( {1.0} ); // error: narrowing
1158
 
1159
  struct A {
@@ -1169,19 +1233,27 @@ g({ "foo", "bar" }); // OK, uses #3
1169
  typedef int IA[3];
1170
  void h(const IA&);
1171
  h({ 1, 2, 3 }); // OK: identity conversion
1172
  ```
1173
 
 
 
 
 
 
 
 
1174
  Otherwise, if the parameter is a non-aggregate class `X` and overload
1175
  resolution per  [[over.match.list]] chooses a single best constructor of
1176
  `X` to perform the initialization of an object of type `X` from the
1177
  argument initializer list, the implicit conversion sequence is a
1178
- user-defined conversion sequence. If multiple constructors are viable
1179
- but none is better than the others, the implicit conversion sequence is
1180
- the ambiguous conversion sequence. User-defined conversions are allowed
1181
- for conversion of the initializer list elements to the constructor
1182
- parameter types except as noted in  [[over.best.ics]].
 
1183
 
1184
  ``` cpp
1185
  struct A {
1186
  A(std::initializer_list<int>);
1187
  };
@@ -1191,11 +1263,11 @@ f( {'a', 'b'} ); // OK: f(A(std::initializer_list<int>)) user-defined
1191
  struct B {
1192
  B(int, double);
1193
  };
1194
  void g(B);
1195
  g( {'a', 'b'} ); // OK: g(B(int,double)) user-defined conversion
1196
- g( {1.0, 1,0} ); // error: narrowing
1197
 
1198
  void f(B);
1199
  f( {'a', 'b'} ); // error: ambiguous f(A) or f(B)
1200
 
1201
  struct C {
@@ -1203,20 +1275,21 @@ struct C {
1203
  };
1204
  void h(C);
1205
  h({"foo"}); // OK: h(C(std::string("foo")))
1206
 
1207
  struct D {
1208
- C(A, C);
1209
  };
1210
  void i(D);
1211
  i({ {1,2}, {"bar"} }); // OK: i(D(A(std::initializer_list<int>{1,2\),C(std::string("bar"))))}
1212
  ```
1213
 
1214
  Otherwise, if the parameter has an aggregate type which can be
1215
  initialized from the initializer list according to the rules for
1216
  aggregate initialization ([[dcl.init.aggr]]), the implicit conversion
1217
- sequence is a user-defined conversion sequence.
 
1218
 
1219
  ``` cpp
1220
  struct A {
1221
  int m1;
1222
  double m2;
@@ -1296,23 +1369,10 @@ conversion sequences unless one of the following rules applies:
1296
  sequence is considered to be a subsequence of any non-identity
1297
  conversion sequence) or, if not that,
1298
  - the rank of `S1` is better than the rank of `S2`, or `S1` and `S2`
1299
  have the same rank and are distinguishable by the rules in the
1300
  paragraph below, or, if not that,
1301
- - `S1`
1302
- and `S2` differ only in their qualification conversion and yield
1303
- similar types `T1` and `T2` ([[conv.qual]]), respectively, and the
1304
- cv-qualification signature of type `T1` is a proper subset of the
1305
- cv-qualification signature of type `T2`.
1306
- ``` cpp
1307
- int f(const int *);
1308
- int f(int *);
1309
- int i;
1310
- int j = f(&i); // calls f(int*)
1311
- ```
1312
-
1313
- or, if not that,
1314
  - `S1` and `S2` are reference bindings ([[dcl.init.ref]]) and neither
1315
  refers to an implicit object parameter of a non-static member
1316
  function declared without a *ref-qualifier*, and `S1` binds an
1317
  rvalue reference to an rvalue and `S2` binds an lvalue reference.
1318
  ``` cpp
@@ -1343,15 +1403,30 @@ conversion sequences unless one of the following rules applies:
1343
  or, if not that,
1344
  - `S1` and `S2` are reference bindings ([[dcl.init.ref]]) and `S1`
1345
  binds an lvalue reference to a function lvalue and `S2` binds an
1346
  rvalue reference to a function lvalue.
1347
  ``` cpp
1348
- template<class T> int f(T&);
1349
- template<class T> int f(T&&);
1350
  void g();
1351
- int i1 = f(g); // calls f(T&)
1352
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1353
  - `S1`
1354
  and `S2` are reference bindings ([[dcl.init.ref]]), and the types
1355
  to which the references refer are the same type except for top-level
1356
  cv-qualifiers, and the type to which the reference initialized by
1357
  `S2` refers is more cv-qualified than the type to which the
@@ -1375,33 +1450,40 @@ conversion sequences unless one of the following rules applies:
1375
  b.f(); // calls X::f()
1376
  }
1377
  ```
1378
  - User-defined conversion sequence `U1` is a better conversion sequence
1379
  than another user-defined conversion sequence `U2` if they contain the
1380
- same user-defined conversion function or constructor or aggregate
1381
- initialization and the second standard conversion sequence of `U1` is
1382
- better than the second standard conversion sequence of `U2`.
 
1383
  ``` cpp
1384
  struct A {
1385
  operator short();
1386
  } a;
1387
  int f(int);
1388
  int f(float);
1389
  int i = f(a); // calls f(int), because short → int is
1390
  // better than short → float.
1391
  ```
1392
  - List-initialization sequence `L1` is a better conversion sequence than
1393
- list-initialization sequence `L2` if `L1` converts to
1394
- `std::initializer_list<X>` for some `X` and `L2` does not.
 
 
 
1395
 
1396
  Standard conversion sequences are ordered by their ranks: an Exact Match
1397
  is a better conversion than a Promotion, which is a better conversion
1398
  than a Conversion. Two conversion sequences with the same rank are
1399
  indistinguishable unless one of the following rules applies:
1400
 
1401
  - A conversion that does not convert a pointer, a pointer to member, or
1402
  `std::nullptr_t` to `bool` is better than one that does.
 
 
 
1403
  - If class `B` is derived directly or indirectly from class `A`,
1404
  conversion of `B*` to `A*` is better than conversion of `B*` to
1405
  `void*`, and conversion of `A*` to `void*` is better than conversion
1406
  of `B*` to `void*`.
1407
  - If class `B` is derived directly or indirectly from class `A` and
@@ -1415,21 +1497,21 @@ indistinguishable unless one of the following rules applies:
1415
  C* pc;
1416
  int f(A*);
1417
  int f(B*);
1418
  int i = f(pc); // calls f(B*)
1419
  ```
1420
- - binding of an expression of type `C` to a reference of type `B&` is
1421
- better than binding an expression of type `C` to a reference of type
1422
- `A&`,
1423
  - conversion of `A::*` to `B::*` is better than conversion of `A::*`
1424
  to `C::*`,
1425
  - conversion of `C` to `B` is better than conversion of `C` to `A`,
1426
  - conversion of `B*` to `A*` is better than conversion of `C*` to
1427
  `A*`,
1428
- - binding of an expression of type `B` to a reference of type `A&` is
1429
- better than binding an expression of type `C` to a reference of type
1430
- `A&`,
1431
  - conversion of `B::*` to `C::*` is better than conversion of `A::*`
1432
  to `C::*`, and
1433
  - conversion of `B` to `A` is better than conversion of `C` to `A`.
1434
 
1435
  Compared conversion sequences will have different source types only in
@@ -1448,11 +1530,11 @@ functions in such contexts. The function selected is the one whose type
1448
  is identical to the function type of the target type required in the
1449
  context. That is, the class of which the function is a member is ignored
1450
  when matching a pointer-to-member-function type. The target can be
1451
 
1452
  - an object or reference being initialized ([[dcl.init]],
1453
- [[dcl.init.ref]]),
1454
  - the left side of an assignment ([[expr.ass]]),
1455
  - a parameter of a function ([[expr.call]]),
1456
  - a parameter of a user-defined operator ([[over.oper]]),
1457
  - the return value of a function, operator function, or conversion (
1458
  [[stmt.return]]),
@@ -1484,16 +1566,16 @@ non-static member function is selected, the reference to the overloaded
1484
  function name is required to have the form of a pointer to member as
1485
  described in  [[expr.unary.op]].
1486
 
1487
  If more than one function is selected, any function template
1488
  specializations in the set are eliminated if the set also contains a
1489
- non-template function, and any given function template specialization
1490
- `F1` is eliminated if the set contains a second function template
1491
- specialization whose function template is more specialized than the
1492
- function template of `F1` according to the partial ordering rules of 
1493
- [[temp.func.order]]. After such eliminations, if any, there shall remain
1494
- exactly one selected function.
1495
 
1496
  ``` cpp
1497
  int f(double);
1498
  int f(int);
1499
  int (*pfd)(double) = &f; // selects f(double)
@@ -1592,11 +1674,11 @@ The allocation and deallocation functions, `operator` `new`, `operator`
1592
  completely in  [[basic.stc.dynamic]]. The attributes and restrictions
1593
  found in the rest of this subclause do not apply to them unless
1594
  explicitly stated in  [[basic.stc.dynamic]].
1595
 
1596
  An operator function shall either be a non-static member function or be
1597
- a non-member function and have at least one parameter whose type is a
1598
  class, a reference to a class, an enumeration, or a reference to an
1599
  enumeration. It is not possible to change the precedence, grouping, or
1600
  number of operands of operators. The meaning of the operators `=`,
1601
  (unary) `&`, and `,` (comma), predefined for each type, can be changed
1602
  for specific class and enumeration types by defining operator functions
@@ -1750,19 +1832,19 @@ is selected as the best match function by the overload resolution
1750
  mechanism ([[over.match]]).
1751
 
1752
  ### Increment and decrement <a id="over.inc">[[over.inc]]</a>
1753
 
1754
  The user-defined function called `operator++` implements the prefix and
1755
- postfix `++` operator. If this function is a member function with no
1756
- parameters, or a non-member function with one parameter of class or
1757
- enumeration type, it defines the prefix increment operator `++` for
1758
- objects of that type. If the function is a member function with one
1759
- parameter (which shall be of type `int`) or a non-member function with
1760
- two parameters (the second of which shall be of type `int`), it defines
1761
- the postfix increment operator `++` for objects of that type. When the
1762
- postfix increment is called as a result of using the `++` operator, the
1763
- `int` argument will have value zero.[^13]
1764
 
1765
  ``` cpp
1766
  struct X {
1767
  X& operator++(); // prefix ++a
1768
  X operator++(int); // postfix a++
@@ -1790,16 +1872,21 @@ analogously.
1790
 
1791
  ### User-defined literals <a id="over.literal">[[over.literal]]</a>
1792
 
1793
  ``` bnf
1794
  literal-operator-id:
1795
- 'operator' '""' identifier
 
1796
  ```
1797
 
1798
- The *identifier* in a *literal-operator-id* is called a *literal suffix
1799
- identifier*. some literal suffix identifiers are reserved for future
1800
- standardization; see  [[usrlit.suffix]].
 
 
 
 
1801
 
1802
  A declaration whose *declarator-id* is a *literal-operator-id* shall be
1803
  a declaration of a namespace-scope function or function template (it
1804
  could be a friend function ([[class.friend]])), an explicit
1805
  instantiation or specialization of a function template, or a
@@ -1822,10 +1909,13 @@ const char*, std::size_t
1822
  const wchar_t*, std::size_t
1823
  const char16_t*, std::size_t
1824
  const char32_t*, std::size_t
1825
  ```
1826
 
 
 
 
1827
  A *raw literal operator* is a literal operator with a single parameter
1828
  whose type is `const char*`.
1829
 
1830
  The declaration of a literal operator template shall have an empty
1831
  *parameter-declaration-clause* and its *template-parameter-list* shall
@@ -1845,17 +1935,20 @@ overload resolution rules. Also, they can be declared `inline` or
1845
  called explicitly, their addresses can be taken, etc.
1846
 
1847
  ``` cpp
1848
  void operator "" _km(long double); // OK
1849
  string operator "" _i18n(const char*, std::size_t); // OK
1850
- template <char...> int operator "" \u03C0(); // OK: UCN for lowercase pi
1851
- float operator ""E(const char*); // error: ""E (with no intervening space)
1852
- // is a single token
1853
- float operator " " B(const char*); // error: non-adjacent quotes
 
 
1854
  string operator "" 5X(const char*, std::size_t); // error: invalid literal suffix identifier
1855
  double operator "" _miles(double); // error: invalid parameter-declaration-clause
1856
- template <char...> int operator "" j(const char*); // error: invalid parameter-declaration-clause
 
1857
  ```
1858
 
1859
  ## Built-in operators <a id="over.built">[[over.built]]</a>
1860
 
1861
  The candidate operator functions that represent the built-in operators
@@ -1946,11 +2039,11 @@ T operator-(T);
1946
 
1947
  For every promoted integral type *T*, there exist candidate operator
1948
  functions of the form
1949
 
1950
  ``` cpp
1951
- T operator\sim(T);
1952
  ```
1953
 
1954
  For every quintuple (*C1*, *C2*, *T*, *CV1*, *CV2*), where *C2* is a
1955
  class type, *C1* is the same type as C2 or is a derived class of C2, *T*
1956
  is an object type or a function type, and *CV1* and *CV2* are
@@ -1959,11 +2052,13 @@ form
1959
 
1960
  ``` cpp
1961
  CV12 T& operator->*(CV1 C1*, CV2 T C2::*);
1962
  ```
1963
 
1964
- where *CV12* is the union of *CV1* and *CV2*.
 
 
1965
 
1966
  For every pair of promoted arithmetic types *L* and *R*, there exist
1967
  candidate operator functions of the form
1968
 
1969
  ``` cpp
@@ -1998,24 +2093,24 @@ candidate operator functions of the form
1998
 
1999
  ``` cpp
2000
  std::ptrdiff_t operator-(T, T);
2001
  ```
2002
 
2003
- For every *T*, where *T* is an enumeration type, a pointer type, or
2004
- `std::nullptr_t`, there exist candidate operator functions of the form
2005
 
2006
  ``` cpp
2007
  bool operator<(T, T);
2008
  bool operator>(T, T);
2009
  bool operator<=(T, T);
2010
  bool operator>=(T, T);
2011
  bool operator==(T, T);
2012
  bool operator!=(T, T);
2013
  ```
2014
 
2015
- For every pointer to member type *T* there exist candidate operator
2016
- functions of the form
2017
 
2018
  ``` cpp
2019
  bool operator==(T, T);
2020
  bool operator!=(T, T);
2021
  ```
@@ -2152,10 +2247,11 @@ T operator?:(bool, T, T);
2152
  [expr]: expr.md#expr
2153
  [expr.ass]: expr.md#expr.ass
2154
  [expr.call]: expr.md#expr.call
2155
  [expr.cast]: expr.md#expr.cast
2156
  [expr.cond]: expr.md#expr.cond
 
2157
  [expr.prim]: expr.md#expr.prim
2158
  [expr.static.cast]: expr.md#expr.static.cast
2159
  [expr.sub]: expr.md#expr.sub
2160
  [expr.type.conv]: expr.md#expr.type.conv
2161
  [expr.unary.op]: expr.md#expr.unary.op
@@ -2214,13 +2310,13 @@ T operator?:(bool, T, T);
2214
  ignored.
2215
 
2216
  [^2]: The process of argument deduction fully determines the parameter
2217
  types of the function template specializations, i.e., the parameters
2218
  of function template specializations contain no template parameter
2219
- types. Therefore the function template specializations can be
2220
- treated as normal (non-template) functions for the remainder of
2221
- overload resolution.
2222
 
2223
  [^3]: Note that cv-qualifiers on the type of objects are significant in
2224
  overload resolution for both glvalue and class prvalue objects.
2225
 
2226
  [^4]: An implied object argument must be contrived to correspond to the
 
377
  refer to one or more function templates and also to a set of overloaded
378
  non-template functions. In such a case, the candidate functions
379
  generated from each function template are combined with the set of
380
  non-template candidate functions.
381
 
382
+ A defaulted move constructor or assignment operator ([[class.copy]])
383
+ that is defined as deleted is excluded from the set of candidate
384
+ functions in all contexts.
385
+
386
  #### Function call syntax <a id="over.match.call">[[over.match.call]]</a>
387
 
388
  In a function call ([[expr.call]])
389
 
390
  ``` bnf
 
467
 
468
  In addition, for each non-explicit conversion function declared in `T`
469
  of the form
470
 
471
  ``` bnf
472
+ 'operator' conversion-type-id '( )' cv-qualifier ref-qualifierₒₚₜ exception-specificationₒₚₜ attribute-specifier-seqₒₚₜ ';'
473
  ```
474
 
475
  where *cv-qualifier* is the same cv-qualification as, or a greater
476
  cv-qualification than, *cv*, and where *conversion-type-id* denotes the
477
  type “pointer to function of (`P1`,...,`Pn)` returning `R`”, or the type
 
541
  };
542
  String operator + (const String&, const String&);
543
 
544
  void f(void) {
545
  const char* p= "one" + "two"; // ill-formed because neither
546
+ // operand has class or enumeration type
547
  int I = 1 + 1; // Always evaluates to 2 even if
548
+ // class or enumeration types exist that
549
  // would perform the operation.
550
  }
551
  ```
552
 
553
  If either operand has a type that is a class or an enumeration, a
 
578
  type whose cv-unqualified version is `T1` and a right operand of a type
579
  whose cv-unqualified version is `T2`, three sets of candidate functions,
580
  designated *member candidates*, *non-member candidates* and *built-in
581
  candidates*, are constructed as follows:
582
 
583
+ - If `T1` is a complete class type or a class currently being defined,
584
+ the set of member candidates is the result of the qualified lookup of
585
+ `T1::operator@` ([[over.call.func]]); otherwise, the set of member
586
+ candidates is empty.
587
  - The set of non-member candidates is the result of the unqualified
588
  lookup of `operator@` in the context of the expression according to
589
  the usual rules for name lookup in unqualified function calls (
590
  [[basic.lookup.argdep]]) except that all member functions are ignored.
591
  However, if no operand has a class type, only those non-member
 
600
  defined in  [[over.built]] that, compared to the given operator,
601
  - have the same operator name, and
602
  - accept the same number of operands, and
603
  - accept operand types to which the given operand or operands can be
604
  converted according to [[over.best.ics]], and
605
+ - do not have the same parameter-type-list as any non-member candidate
606
+ that is not a function template specialization.
607
 
608
  For the built-in assignment operators, conversions of the left operand
609
  are restricted as follows:
610
 
611
  - no temporaries are introduced to hold the left operand, and
 
631
  a + b; // operator+(a,b) chosen over int(a) + int(b)
632
  }
633
  ```
634
 
635
  If a built-in candidate is selected by overload resolution, the operands
636
+ of class type are converted to the types of the corresponding parameters
637
+ of the selected operation function, except that the second standard
638
+ conversion sequence of a user-defined conversion sequence (
639
+ [[over.ics.user]]) is not applied. Then the operator is treated as the
640
  corresponding built-in operator and interpreted according to Clause 
641
  [[expr]].
642
 
643
+ ``` cpp
644
+ struct X {
645
+ operator double();
646
+ };
647
+
648
+ struct Y {
649
+ operator int*();
650
+ };
651
+
652
+ int *a = Y() + 100.0; // error: pointer arithmetic requires integral operand
653
+ int *b = Y() + X(); // error: pointer arithmetic requires integral operand
654
+ ```
655
+
656
  The second operand of operator `->` is ignored in selecting an
657
  `operator->` function, and is not an argument when the `operator->`
658
  function is called. When `operator->` returns, the operator `->` is
659
  applied to the value returned, with the original second operand.[^7]
660
 
 
699
 
700
  Under the conditions specified in  [[dcl.init]], as part of a
701
  copy-initialization of an object of class type, a user-defined
702
  conversion can be invoked to convert an initializer expression to the
703
  type of the object being initialized. Overload resolution is used to
704
+ select the user-defined conversion to be invoked. The conversion
705
+ performed for indirect binding to a reference to a possibly cv-qualified
706
+ class type is determined in terms of a corresponding non-reference
707
+ copy-initialization. Assuming that “*cv1* `T`” is the type of the object
708
+ being initialized, with `T` a class type, the candidate functions are
709
+ selected as follows:
710
 
711
  - The converting constructors ([[class.conv.ctor]]) of `T` are
712
  candidate functions.
713
  - When the type of the initializer expression is a class type “*cv*
714
  `S`”, the non-explicit conversion functions of `S` and its base
715
  classes are considered. When initializing a temporary to be bound to
716
  the first parameter of a constructor that takes a reference to
717
  possibly cv-qualified `T` as its first argument, called with a single
718
+ argument in the context of direct-initialization of an object of type
719
+ “*cv2* `T`”, explicit conversion functions are also considered. Those
720
+ that are not hidden within `S` and yield a type whose cv-unqualified
721
+ version is the same type as `T` or is a derived class thereof are
722
+ candidate functions. Conversion functions that return “reference to
723
+ `X`” return lvalues or xvalues, depending on the type of reference, of
724
+ type `X` and are therefore considered to yield `X` for this process of
725
+ selecting candidate functions.
726
 
727
  In both cases, the argument list has one argument, which is the
728
  initializer expression. This argument will be compared against the first
729
  parameter of the constructors and against the implicit object parameter
730
  of the conversion functions.
 
767
  resolution is used to select the conversion function to be invoked.
768
  Assuming that “*cv1* `T`” is the underlying type of the reference being
769
  initialized, and “*cv* `S`” is the type of the initializer expression,
770
  with `S` a class type, the candidate functions are selected as follows:
771
 
772
+ - The conversion functions of `S` and its base classes are considered.
773
+ Those non-explicit conversion functions that are not hidden within `S`
774
+ and yield type “lvalue reference to *cv2* `T2` (when initializing an
775
+ lvalue reference or an rvalue reference to function) or “ `T2`” or
776
+ “rvalue reference to `T2`” (when initializing an rvalue reference or
777
+ an lvalue reference to function), where “*cv1* `T`” is
778
+ reference-compatible ([[dcl.init.ref]]) with “*cv2* `T2`”, are
779
+ candidate functions. For direct-initialization, those explicit
780
+ conversion functions that are not hidden within `S` and yield type
781
+ “lvalue reference to *cv2* `T2`” or “*cv2* `T2`” or “rvalue reference
782
+ to *cv2* `T2`,” respectively, where `T2` is the same type as `T` or
783
+ can be converted to type `T` with a qualification conversion (
784
+ [[conv.qual]]), are also candidate functions.
785
 
786
  The argument list has one argument, which is the initializer expression.
787
  This argument will be compared against the implicit object parameter of
788
  the conversion functions.
789
 
 
883
  float x = a; // ambiguous: both possibilities require conversions,
884
  // and neither is better than the other
885
  ```
886
 
887
  or, if not that,
888
+ - the context is an initialization by conversion function for direct
889
+ reference binding ([[over.match.ref]]) of a reference to function
890
+ type, the return type of `F1` is the same kind of reference (i.e.
891
+ lvalue or rvalue) as the reference being initialized, and the return
892
+ type of `F2` is not
893
+ ``` cpp
894
+ template <class T> struct A {
895
+ operator T&(); // #1
896
+ operator T&&(); // #2
897
+ };
898
+ typedef int Fn();
899
+ A<Fn> a;
900
+ Fn& lf = a; // calls #1
901
+ Fn&& rf = a; // calls #2
902
+ ```
903
+
904
+ or, if not that,
905
+ - `F1` is not a function template specialization and `F2` is a function
906
+ template specialization, or, if not that,
907
  - `F1` and `F2` are function template specializations, and the function
908
  template for `F1` is more specialized than the template for `F2`
909
  according to the partial ordering rules described in 
910
  [[temp.func.order]].
911
 
 
982
 
983
  - a *standard conversion sequence* ([[over.ics.scs]]),
984
  - a *user-defined conversion sequence* ([[over.ics.user]]), or
985
  - an *ellipsis conversion sequence* ([[over.ics.ellipsis]]).
986
 
987
+ However, if the target is
988
+
989
+ - the first parameter of a constructor or
990
+ - the implicit object parameter of a user-defined conversion function
991
+
992
+ and the constructor or user-defined conversion function is a candidate
993
+ by
994
+
995
+ - [[over.match.ctor]], when the argument is the temporary in the second
996
+ step of a class copy-initialization,
997
+ - [[over.match.copy]], [[over.match.conv]], or [[over.match.ref]] (in
998
+ all cases), or
999
+ - the second phase of [[over.match.list]] when the initializer list has
1000
+ exactly one element, and the target is the first parameter of a
1001
+ constructor of class `X`, and the conversion is to `X` or reference to
1002
+ (possibly cv-qualified) `X`,
1003
+
1004
+ user-defined conversion sequences are not considered. These rules
1005
+ prevent more than one user-defined conversion from being applied during
1006
+ overload resolution, thereby avoiding infinite recursion.
1007
+
1008
+ ``` cpp
1009
+ struct Y { Y(int); };
1010
+ struct A { operator int(); };
1011
+ Y y1 = A(); // error: A::operator int() is not a candidate
1012
+
1013
+ struct X { };
1014
+ struct B { operator X(); };
1015
+ B b;
1016
+ X x({b}); // error: B::operator X() is not a candidate
1017
+ ```
1018
 
1019
  For the case where the parameter type is a reference, see 
1020
  [[over.ics.ref]].
1021
 
1022
  When the parameter type is not a reference, the implicit conversion
 
1134
  shall have exact match rank.
1135
 
1136
  A conversion of an expression of class type to the same class type is
1137
  given Exact Match rank, and a conversion of an expression of class type
1138
  to a base class of that type is given Conversion rank, in spite of the
1139
+ fact that a constructor (i.e., a user-defined conversion function) is
1140
+ called for those cases.
1141
 
1142
  ##### Ellipsis conversion sequences <a id="over.ics.ellipsis">[[over.ics.ellipsis]]</a>
1143
 
1144
  An ellipsis conversion sequence occurs when an argument in a function
1145
  call is matched with the ellipsis parameter specification of the
 
1197
  an `int` lvalue and finds an exact match with the parameter. If the
1198
  function is selected by overload resolution, the call will nonetheless
1199
  be ill-formed because of the prohibition on binding a non-`const` lvalue
1200
  reference to a bit-field ([[dcl.init.ref]]).
1201
 
 
 
 
 
1202
  ##### List-initialization sequence <a id="over.ics.list">[[over.ics.list]]</a>
1203
 
1204
  When an argument is an initializer list ([[dcl.init.list]]), it is not
1205
  an expression and special rules apply for converting it to a parameter
1206
  type.
1207
 
1208
+ If the parameter type is `std::initializer_list<X>` and all the elements
1209
+ of the initializer list can be implicitly converted to `X`, the implicit
1210
+ conversion sequence is the worst conversion necessary to convert an
1211
+ element of the list to `X`, or if the initializer list has no elements,
1212
+ the identity conversion. This conversion can be a user-defined
1213
+ conversion even in the context of a call to an initializer-list
1214
+ constructor.
1215
 
1216
  ``` cpp
1217
  void f(std::initializer_list<int>);
1218
+ f( {} ); // OK: f(initializer_list<int>) identity conversion
1219
  f( {1,2,3} ); // OK: f(initializer_list<int>) identity conversion
1220
  f( {'a','b'} ); // OK: f(initializer_list<int>) integral promotion
1221
  f( {1.0} ); // error: narrowing
1222
 
1223
  struct A {
 
1233
  typedef int IA[3];
1234
  void h(const IA&);
1235
  h({ 1, 2, 3 }); // OK: identity conversion
1236
  ```
1237
 
1238
+ Otherwise, if the parameter type is “array of `N` `X`”[^12], if the
1239
+ initializer list has exactly `N` elements or if it has fewer than `N`
1240
+ elements and `X` is default-constructible, and if all the elements of
1241
+ the initializer list can be implicitly converted to `X`, the implicit
1242
+ conversion sequence is the worst conversion necessary to convert an
1243
+ element of the list to `X`.
1244
+
1245
  Otherwise, if the parameter is a non-aggregate class `X` and overload
1246
  resolution per  [[over.match.list]] chooses a single best constructor of
1247
  `X` to perform the initialization of an object of type `X` from the
1248
  argument initializer list, the implicit conversion sequence is a
1249
+ user-defined conversion sequence with the second standard conversion
1250
+ sequence an identity conversion. If multiple constructors are viable but
1251
+ none is better than the others, the implicit conversion sequence is the
1252
+ ambiguous conversion sequence. User-defined conversions are allowed for
1253
+ conversion of the initializer list elements to the constructor parameter
1254
+ types except as noted in  [[over.best.ics]].
1255
 
1256
  ``` cpp
1257
  struct A {
1258
  A(std::initializer_list<int>);
1259
  };
 
1263
  struct B {
1264
  B(int, double);
1265
  };
1266
  void g(B);
1267
  g( {'a', 'b'} ); // OK: g(B(int,double)) user-defined conversion
1268
+ g( {1.0, 1.0} ); // error: narrowing
1269
 
1270
  void f(B);
1271
  f( {'a', 'b'} ); // error: ambiguous f(A) or f(B)
1272
 
1273
  struct C {
 
1275
  };
1276
  void h(C);
1277
  h({"foo"}); // OK: h(C(std::string("foo")))
1278
 
1279
  struct D {
1280
+ D(A, C);
1281
  };
1282
  void i(D);
1283
  i({ {1,2}, {"bar"} }); // OK: i(D(A(std::initializer_list<int>{1,2\),C(std::string("bar"))))}
1284
  ```
1285
 
1286
  Otherwise, if the parameter has an aggregate type which can be
1287
  initialized from the initializer list according to the rules for
1288
  aggregate initialization ([[dcl.init.aggr]]), the implicit conversion
1289
+ sequence is a user-defined conversion sequence with the second standard
1290
+ conversion sequence an identity conversion.
1291
 
1292
  ``` cpp
1293
  struct A {
1294
  int m1;
1295
  double m2;
 
1369
  sequence is considered to be a subsequence of any non-identity
1370
  conversion sequence) or, if not that,
1371
  - the rank of `S1` is better than the rank of `S2`, or `S1` and `S2`
1372
  have the same rank and are distinguishable by the rules in the
1373
  paragraph below, or, if not that,
 
 
 
 
 
 
 
 
 
 
 
 
 
1374
  - `S1` and `S2` are reference bindings ([[dcl.init.ref]]) and neither
1375
  refers to an implicit object parameter of a non-static member
1376
  function declared without a *ref-qualifier*, and `S1` binds an
1377
  rvalue reference to an rvalue and `S2` binds an lvalue reference.
1378
  ``` cpp
 
1403
  or, if not that,
1404
  - `S1` and `S2` are reference bindings ([[dcl.init.ref]]) and `S1`
1405
  binds an lvalue reference to a function lvalue and `S2` binds an
1406
  rvalue reference to a function lvalue.
1407
  ``` cpp
1408
+ int f(void(&)()); // #1
1409
+ int f(void(&&)()); // #2
1410
  void g();
1411
+ int i1 = f(g); // calls #1
1412
  ```
1413
+
1414
+ or, if not that,
1415
+ - `S1`
1416
+ and `S2` differ only in their qualification conversion and yield
1417
+ similar types `T1` and `T2` ([[conv.qual]]), respectively, and the
1418
+ cv-qualification signature of type `T1` is a proper subset of the
1419
+ cv-qualification signature of type `T2`.
1420
+ ``` cpp
1421
+ int f(const volatile int *);
1422
+ int f(const int *);
1423
+ int i;
1424
+ int j = f(&i); // calls f(const int*)
1425
+ ```
1426
+
1427
+ or, if not that,
1428
  - `S1`
1429
  and `S2` are reference bindings ([[dcl.init.ref]]), and the types
1430
  to which the references refer are the same type except for top-level
1431
  cv-qualifiers, and the type to which the reference initialized by
1432
  `S2` refers is more cv-qualified than the type to which the
 
1450
  b.f(); // calls X::f()
1451
  }
1452
  ```
1453
  - User-defined conversion sequence `U1` is a better conversion sequence
1454
  than another user-defined conversion sequence `U2` if they contain the
1455
+ same user-defined conversion function or constructor or they
1456
+ initialize the same class in an aggregate initialization and in either
1457
+ case the second standard conversion sequence of `U1` is better than
1458
+ the second standard conversion sequence of `U2`.
1459
  ``` cpp
1460
  struct A {
1461
  operator short();
1462
  } a;
1463
  int f(int);
1464
  int f(float);
1465
  int i = f(a); // calls f(int), because short → int is
1466
  // better than short → float.
1467
  ```
1468
  - List-initialization sequence `L1` is a better conversion sequence than
1469
+ list-initialization sequence `L2` if
1470
+ - `L1` converts to `std::initializer_list<X>` for some `X` and `L2`
1471
+ does not, or, if not that,
1472
+ - `L1` converts to type “array of `N1` `T`”, `L2` converts to type
1473
+ “array of `N2` `T`”, and `N1` is smaller than `N2`.
1474
 
1475
  Standard conversion sequences are ordered by their ranks: an Exact Match
1476
  is a better conversion than a Promotion, which is a better conversion
1477
  than a Conversion. Two conversion sequences with the same rank are
1478
  indistinguishable unless one of the following rules applies:
1479
 
1480
  - A conversion that does not convert a pointer, a pointer to member, or
1481
  `std::nullptr_t` to `bool` is better than one that does.
1482
+ - A conversion that promotes an enumeration whose underlying type is
1483
+ fixed to its underlying type is better than one that promotes to the
1484
+ promoted underlying type, if the two are different.
1485
  - If class `B` is derived directly or indirectly from class `A`,
1486
  conversion of `B*` to `A*` is better than conversion of `B*` to
1487
  `void*`, and conversion of `A*` to `void*` is better than conversion
1488
  of `B*` to `void*`.
1489
  - If class `B` is derived directly or indirectly from class `A` and
 
1497
  C* pc;
1498
  int f(A*);
1499
  int f(B*);
1500
  int i = f(pc); // calls f(B*)
1501
  ```
1502
+ - binding of an expression of type `C` to a reference to type `B` is
1503
+ better than binding an expression of type `C` to a reference to type
1504
+ `A`,
1505
  - conversion of `A::*` to `B::*` is better than conversion of `A::*`
1506
  to `C::*`,
1507
  - conversion of `C` to `B` is better than conversion of `C` to `A`,
1508
  - conversion of `B*` to `A*` is better than conversion of `C*` to
1509
  `A*`,
1510
+ - binding of an expression of type `B` to a reference to type `A` is
1511
+ better than binding an expression of type `C` to a reference to type
1512
+ `A`,
1513
  - conversion of `B::*` to `C::*` is better than conversion of `A::*`
1514
  to `C::*`, and
1515
  - conversion of `B` to `A` is better than conversion of `C` to `A`.
1516
 
1517
  Compared conversion sequences will have different source types only in
 
1530
  is identical to the function type of the target type required in the
1531
  context. That is, the class of which the function is a member is ignored
1532
  when matching a pointer-to-member-function type. The target can be
1533
 
1534
  - an object or reference being initialized ([[dcl.init]],
1535
+ [[dcl.init.ref]], [[dcl.init.list]]),
1536
  - the left side of an assignment ([[expr.ass]]),
1537
  - a parameter of a function ([[expr.call]]),
1538
  - a parameter of a user-defined operator ([[over.oper]]),
1539
  - the return value of a function, operator function, or conversion (
1540
  [[stmt.return]]),
 
1566
  function name is required to have the form of a pointer to member as
1567
  described in  [[expr.unary.op]].
1568
 
1569
  If more than one function is selected, any function template
1570
  specializations in the set are eliminated if the set also contains a
1571
+ function that is not a function template specialization, and any given
1572
+ function template specialization `F1` is eliminated if the set contains
1573
+ a second function template specialization whose function template is
1574
+ more specialized than the function template of `F1` according to the
1575
+ partial ordering rules of  [[temp.func.order]]. After such eliminations,
1576
+ if any, there shall remain exactly one selected function.
1577
 
1578
  ``` cpp
1579
  int f(double);
1580
  int f(int);
1581
  int (*pfd)(double) = &f; // selects f(double)
 
1674
  completely in  [[basic.stc.dynamic]]. The attributes and restrictions
1675
  found in the rest of this subclause do not apply to them unless
1676
  explicitly stated in  [[basic.stc.dynamic]].
1677
 
1678
  An operator function shall either be a non-static member function or be
1679
+ a non-member function that has at least one parameter whose type is a
1680
  class, a reference to a class, an enumeration, or a reference to an
1681
  enumeration. It is not possible to change the precedence, grouping, or
1682
  number of operands of operators. The meaning of the operators `=`,
1683
  (unary) `&`, and `,` (comma), predefined for each type, can be changed
1684
  for specific class and enumeration types by defining operator functions
 
1832
  mechanism ([[over.match]]).
1833
 
1834
  ### Increment and decrement <a id="over.inc">[[over.inc]]</a>
1835
 
1836
  The user-defined function called `operator++` implements the prefix and
1837
+ postfix `++` operator. If this function is a non-static member function
1838
+ with no parameters, or a non-member function with one parameter, it
1839
+ defines the prefix increment operator `++` for objects of that type. If
1840
+ the function is a non-static member function with one parameter (which
1841
+ shall be of type `int`) or a non-member function with two parameters
1842
+ (the second of which shall be of type `int`), it defines the postfix
1843
+ increment operator `++` for objects of that type. When the postfix
1844
+ increment is called as a result of using the `++` operator, the `int`
1845
+ argument will have value zero.[^13]
1846
 
1847
  ``` cpp
1848
  struct X {
1849
  X& operator++(); // prefix ++a
1850
  X operator++(int); // postfix a++
 
1872
 
1873
  ### User-defined literals <a id="over.literal">[[over.literal]]</a>
1874
 
1875
  ``` bnf
1876
  literal-operator-id:
1877
+ 'operator' string-literal identifier
1878
+ 'operator' user-defined-string-literal
1879
  ```
1880
 
1881
+ The *string-literal* or *user-defined-string-literal* in a
1882
+ *literal-operator-id* shall have no *encoding-prefix* and shall contain
1883
+ no characters other than the implicit terminating `'\0'`. The
1884
+ *ud-suffix* of the *user-defined-string-literal* or the *identifier* in
1885
+ a *literal-operator-id* is called a *literal suffix identifier*. some
1886
+ literal suffix identifiers are reserved for future standardization; see 
1887
+ [[usrlit.suffix]].
1888
 
1889
  A declaration whose *declarator-id* is a *literal-operator-id* shall be
1890
  a declaration of a namespace-scope function or function template (it
1891
  could be a friend function ([[class.friend]])), an explicit
1892
  instantiation or specialization of a function template, or a
 
1909
  const wchar_t*, std::size_t
1910
  const char16_t*, std::size_t
1911
  const char32_t*, std::size_t
1912
  ```
1913
 
1914
+ If a parameter has a default argument ([[dcl.fct.default]]), the
1915
+ program is ill-formed.
1916
+
1917
  A *raw literal operator* is a literal operator with a single parameter
1918
  whose type is `const char*`.
1919
 
1920
  The declaration of a literal operator template shall have an empty
1921
  *parameter-declaration-clause* and its *template-parameter-list* shall
 
1935
  called explicitly, their addresses can be taken, etc.
1936
 
1937
  ``` cpp
1938
  void operator "" _km(long double); // OK
1939
  string operator "" _i18n(const char*, std::size_t); // OK
1940
+ template <char...> double operator "" _\u03C0(); // OK: UCN for lowercase pi
1941
+ float operator ""_e(const char*); // OK
1942
+ float operator ""E(const char*); // error: reserved literal suffix~([usrlit.suffix], [lex.ext])
1943
+ double operator""_Bq(long double); // OK: does not use the reserved name _Bq~([global.names])
1944
+ double operator"" _Bq(long double); // uses the reserved name _Bq~([global.names])
1945
+ float operator " " B(const char*); // error: non-empty string-literal
1946
  string operator "" 5X(const char*, std::size_t); // error: invalid literal suffix identifier
1947
  double operator "" _miles(double); // error: invalid parameter-declaration-clause
1948
+ template <char...> int operator "" _j(const char*); // error: invalid parameter-declaration-clause
1949
+ extern "C" void operator "" _m(long double); // error: C language linkage
1950
  ```
1951
 
1952
  ## Built-in operators <a id="over.built">[[over.built]]</a>
1953
 
1954
  The candidate operator functions that represent the built-in operators
 
2039
 
2040
  For every promoted integral type *T*, there exist candidate operator
2041
  functions of the form
2042
 
2043
  ``` cpp
2044
+ T operator~(T);
2045
  ```
2046
 
2047
  For every quintuple (*C1*, *C2*, *T*, *CV1*, *CV2*), where *C2* is a
2048
  class type, *C1* is the same type as C2 or is a derived class of C2, *T*
2049
  is an object type or a function type, and *CV1* and *CV2* are
 
2052
 
2053
  ``` cpp
2054
  CV12 T& operator->*(CV1 C1*, CV2 T C2::*);
2055
  ```
2056
 
2057
+ where *CV12* is the union of *CV1* and *CV2*. The return type is shown
2058
+ for exposition only; see  [[expr.mptr.oper]] for the determination of
2059
+ the operator’s result type.
2060
 
2061
  For every pair of promoted arithmetic types *L* and *R*, there exist
2062
  candidate operator functions of the form
2063
 
2064
  ``` cpp
 
2093
 
2094
  ``` cpp
2095
  std::ptrdiff_t operator-(T, T);
2096
  ```
2097
 
2098
+ For every *T*, where *T* is an enumeration type or a pointer type, there
2099
+ exist candidate operator functions of the form
2100
 
2101
  ``` cpp
2102
  bool operator<(T, T);
2103
  bool operator>(T, T);
2104
  bool operator<=(T, T);
2105
  bool operator>=(T, T);
2106
  bool operator==(T, T);
2107
  bool operator!=(T, T);
2108
  ```
2109
 
2110
+ For every pointer to member type *T* or type `std::nullptr_t` there
2111
+ exist candidate operator functions of the form
2112
 
2113
  ``` cpp
2114
  bool operator==(T, T);
2115
  bool operator!=(T, T);
2116
  ```
 
2247
  [expr]: expr.md#expr
2248
  [expr.ass]: expr.md#expr.ass
2249
  [expr.call]: expr.md#expr.call
2250
  [expr.cast]: expr.md#expr.cast
2251
  [expr.cond]: expr.md#expr.cond
2252
+ [expr.mptr.oper]: expr.md#expr.mptr.oper
2253
  [expr.prim]: expr.md#expr.prim
2254
  [expr.static.cast]: expr.md#expr.static.cast
2255
  [expr.sub]: expr.md#expr.sub
2256
  [expr.type.conv]: expr.md#expr.type.conv
2257
  [expr.unary.op]: expr.md#expr.unary.op
 
2310
  ignored.
2311
 
2312
  [^2]: The process of argument deduction fully determines the parameter
2313
  types of the function template specializations, i.e., the parameters
2314
  of function template specializations contain no template parameter
2315
+ types. Therefore, except where specified otherwise, function
2316
+ template specializations and non-template functions ([[dcl.fct]])
2317
+ are treated equivalently for the remainder of overload resolution.
2318
 
2319
  [^3]: Note that cv-qualifiers on the type of objects are significant in
2320
  overload resolution for both glvalue and class prvalue objects.
2321
 
2322
  [^4]: An implied object argument must be contrived to correspond to the