tmp/tmpyx2weuff/{from.md → to.md}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
## Name lookup <a id="basic.lookup">[[basic.lookup]]</a>
|
| 2 |
|
| 3 |
### General <a id="basic.lookup.general">[[basic.lookup.general]]</a>
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
Unless otherwise specified, the program is ill-formed if no declarations
|
| 11 |
are found. If the declarations found by name lookup all denote functions
|
| 12 |
or function templates, the declarations are said to form an *overload
|
| 13 |
set*. Otherwise, if the declarations found by name lookup do not all
|
| 14 |
denote the same entity, they are *ambiguous* and the program is
|
|
@@ -81,18 +81,18 @@ the *using-declarator* [[namespace.udecl]].
|
|
| 81 |
|
| 82 |
In certain contexts, only certain kinds of declarations are included.
|
| 83 |
After any such restriction, any declarations of classes or enumerations
|
| 84 |
are discarded if any other declarations are found.
|
| 85 |
|
| 86 |
-
[*Note 4*: A type (but not a
|
| 87 |
hidden by any other entity in its scope. — *end note*]
|
| 88 |
|
| 89 |
However, if a lookup is *type-only*, only declarations of types and
|
| 90 |
templates whose specializations are types are considered; furthermore,
|
| 91 |
-
if declarations of a
|
| 92 |
-
|
| 93 |
-
|
| 94 |
|
| 95 |
### Member name lookup <a id="class.member.lookup">[[class.member.lookup]]</a>
|
| 96 |
|
| 97 |
A *search* in a scope X for a name M from a program point P is a single
|
| 98 |
search in X for M from P unless X is the scope of a class or class
|
|
@@ -434,11 +434,11 @@ name in the *unqualified-id* does not find any
|
|
| 434 |
- function declaration inhabiting a block scope, or
|
| 435 |
- declaration not of a function or function template
|
| 436 |
|
| 437 |
then lookup for the name also includes the result of
|
| 438 |
*argument-dependent lookup* in a set of associated namespaces that
|
| 439 |
-
depends on the types of the arguments (and for template template
|
| 440 |
arguments, the namespace of the template argument), as specified below.
|
| 441 |
|
| 442 |
[*Example 1*:
|
| 443 |
|
| 444 |
``` cpp
|
|
@@ -500,26 +500,34 @@ lookup does not apply and the friend function `f` is not found.
|
|
| 500 |
|
| 501 |
— *end note*]
|
| 502 |
|
| 503 |
For each argument type `T` in the function call, there is a set of zero
|
| 504 |
or more *associated entities* to be considered. The set of entities is
|
| 505 |
-
determined entirely by the types of the function arguments (and any
|
| 506 |
template template arguments). Any *typedef-name*s and
|
| 507 |
*using-declaration*s used to specify the types do not contribute to this
|
| 508 |
set. The set of entities is determined in the following way:
|
| 509 |
|
| 510 |
-
- If `T` is
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 511 |
- If `T` is a class type (including unions), its associated entities
|
| 512 |
-
are: the class itself; the class of which it is a member, if any; and
|
| 513 |
-
its direct and indirect base classes.
|
| 514 |
-
template specialization, its associated
|
| 515 |
-
entities associated with the types of the
|
| 516 |
-
for template type parameters; the
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
|
|
|
| 521 |
- If `T` is an enumeration type, its associated entities are `T` and, if
|
| 522 |
it is a class member, the member’s class.
|
| 523 |
- If `T` is a pointer to `U` or an array of `U`, its associated entities
|
| 524 |
are those associated with `U`.
|
| 525 |
- If `T` is a function type, its associated entities are those
|
|
@@ -535,12 +543,12 @@ set. The set of entities is determined in the following way:
|
|
| 535 |
In addition, if the argument is an overload set or the address of such a
|
| 536 |
set, its associated entities are the union of those associated with each
|
| 537 |
of the members of the set, i.e., the entities associated with its
|
| 538 |
parameter types and return type. Additionally, if the aforementioned
|
| 539 |
overload set is named with a *template-id*, its associated entities also
|
| 540 |
-
include its template
|
| 541 |
-
type
|
| 542 |
|
| 543 |
The *associated namespaces* for a call are the innermost enclosing
|
| 544 |
non-inline namespaces for its associated entities as well as every
|
| 545 |
element of the inline namespace set [[namespace.def]] of those
|
| 546 |
namespaces. Argument-dependent lookup finds all declarations of
|
|
@@ -609,11 +617,11 @@ void test() {
|
|
| 609 |
}
|
| 610 |
```
|
| 611 |
|
| 612 |
— *end example*]
|
| 613 |
|
| 614 |
-
[*Note
|
| 615 |
considered by ordinary unqualified lookup. — *end note*]
|
| 616 |
|
| 617 |
[*Example 3*:
|
| 618 |
|
| 619 |
``` cpp
|
|
@@ -637,14 +645,15 @@ int main() {
|
|
| 637 |
|
| 638 |
#### General <a id="basic.lookup.qual.general">[[basic.lookup.qual.general]]</a>
|
| 639 |
|
| 640 |
Lookup of an *identifier* followed by a `::` scope resolution operator
|
| 641 |
considers only namespaces, types, and templates whose specializations
|
| 642 |
-
are types. If a name, *template-id*,
|
| 643 |
-
by a `::`, it shall
|
| 644 |
-
dependent
|
| 645 |
-
|
|
|
|
| 646 |
|
| 647 |
[*Example 1*:
|
| 648 |
|
| 649 |
``` cpp
|
| 650 |
class A {
|
|
@@ -681,13 +690,13 @@ A *qualified name* is
|
|
| 681 |
- the terminal name of
|
| 682 |
- a *qualified-id*,
|
| 683 |
- a *using-declarator*,
|
| 684 |
- a *typename-specifier*,
|
| 685 |
- a *qualified-namespace-specifier*, or
|
| 686 |
-
- a *nested-name-specifier*, *
|
| 687 |
-
*class-or-decltype* that has a
|
| 688 |
-
[[expr.prim.id.qual]].
|
| 689 |
|
| 690 |
The *lookup context* of a member-qualified name is the type of its
|
| 691 |
associated object expression (considered dependent if the object
|
| 692 |
expression is type-dependent). The lookup context of any other qualified
|
| 693 |
name is the type, template, or namespace nominated by the preceding
|
|
|
|
| 1 |
## Name lookup <a id="basic.lookup">[[basic.lookup]]</a>
|
| 2 |
|
| 3 |
### General <a id="basic.lookup.general">[[basic.lookup.general]]</a>
|
| 4 |
|
| 5 |
+
*Name lookup* associates the use of a name with a set of declarations
|
| 6 |
+
[[basic.def]] of that name. The name lookup rules apply uniformly to all
|
| 7 |
+
names (including *typedef-name*s [[dcl.typedef]], *namespace-name*s
|
| 8 |
+
[[basic.namespace]], and *class-name*s [[class.name]]) wherever the
|
| 9 |
+
grammar allows such names in the context discussed by a particular rule.
|
| 10 |
Unless otherwise specified, the program is ill-formed if no declarations
|
| 11 |
are found. If the declarations found by name lookup all denote functions
|
| 12 |
or function templates, the declarations are said to form an *overload
|
| 13 |
set*. Otherwise, if the declarations found by name lookup do not all
|
| 14 |
denote the same entity, they are *ambiguous* and the program is
|
|
|
|
| 81 |
|
| 82 |
In certain contexts, only certain kinds of declarations are included.
|
| 83 |
After any such restriction, any declarations of classes or enumerations
|
| 84 |
are discarded if any other declarations are found.
|
| 85 |
|
| 86 |
+
[*Note 4*: A type (but not a type alias or template) is therefore
|
| 87 |
hidden by any other entity in its scope. — *end note*]
|
| 88 |
|
| 89 |
However, if a lookup is *type-only*, only declarations of types and
|
| 90 |
templates whose specializations are types are considered; furthermore,
|
| 91 |
+
if declarations of a type alias and of its underlying entity are found,
|
| 92 |
+
the declaration of the type alias is discarded instead of the type
|
| 93 |
+
declaration.
|
| 94 |
|
| 95 |
### Member name lookup <a id="class.member.lookup">[[class.member.lookup]]</a>
|
| 96 |
|
| 97 |
A *search* in a scope X for a name M from a program point P is a single
|
| 98 |
search in X for M from P unless X is the scope of a class or class
|
|
|
|
| 434 |
- function declaration inhabiting a block scope, or
|
| 435 |
- declaration not of a function or function template
|
| 436 |
|
| 437 |
then lookup for the name also includes the result of
|
| 438 |
*argument-dependent lookup* in a set of associated namespaces that
|
| 439 |
+
depends on the types of the arguments (and for type template template
|
| 440 |
arguments, the namespace of the template argument), as specified below.
|
| 441 |
|
| 442 |
[*Example 1*:
|
| 443 |
|
| 444 |
``` cpp
|
|
|
|
| 500 |
|
| 501 |
— *end note*]
|
| 502 |
|
| 503 |
For each argument type `T` in the function call, there is a set of zero
|
| 504 |
or more *associated entities* to be considered. The set of entities is
|
| 505 |
+
determined entirely by the types of the function arguments (and any type
|
| 506 |
template template arguments). Any *typedef-name*s and
|
| 507 |
*using-declaration*s used to specify the types do not contribute to this
|
| 508 |
set. The set of entities is determined in the following way:
|
| 509 |
|
| 510 |
+
- If `T` is `std::meta::info` [[meta.syn]], its associated set of
|
| 511 |
+
entities is the singleton containing the enumeration type
|
| 512 |
+
`std::meta::operators` [[meta.reflection.operators]]. \[*Note 2*: The
|
| 513 |
+
`std::meta::info` type is a type alias, so an explicit rule is needed
|
| 514 |
+
to associate calls whose arguments are reflections with the namespace
|
| 515 |
+
`std::meta`. — *end note*]
|
| 516 |
+
- If `T` is any other fundamental type, its associated set of entities
|
| 517 |
+
is empty.
|
| 518 |
- If `T` is a class type (including unions), its associated entities
|
| 519 |
+
are: the class itself; the class of which it is a member, if any; and,
|
| 520 |
+
if it is a complete type, its direct and indirect base classes.
|
| 521 |
+
Furthermore, if `T` is a class template specialization, its associated
|
| 522 |
+
entities also include: the entities associated with the types of the
|
| 523 |
+
template arguments provided for template type parameters; the
|
| 524 |
+
templates used as type template template arguments; and the classes of
|
| 525 |
+
which any member templates used as type template template arguments
|
| 526 |
+
are members. \[*Note 3*: Constant template arguments, variable
|
| 527 |
+
template template arguments, and concept template arguments do not
|
| 528 |
+
contribute to the set of associated entities. — *end note*]
|
| 529 |
- If `T` is an enumeration type, its associated entities are `T` and, if
|
| 530 |
it is a class member, the member’s class.
|
| 531 |
- If `T` is a pointer to `U` or an array of `U`, its associated entities
|
| 532 |
are those associated with `U`.
|
| 533 |
- If `T` is a function type, its associated entities are those
|
|
|
|
| 543 |
In addition, if the argument is an overload set or the address of such a
|
| 544 |
set, its associated entities are the union of those associated with each
|
| 545 |
of the members of the set, i.e., the entities associated with its
|
| 546 |
parameter types and return type. Additionally, if the aforementioned
|
| 547 |
overload set is named with a *template-id*, its associated entities also
|
| 548 |
+
include its template template arguments and those associated with its
|
| 549 |
+
type template arguments.
|
| 550 |
|
| 551 |
The *associated namespaces* for a call are the innermost enclosing
|
| 552 |
non-inline namespaces for its associated entities as well as every
|
| 553 |
element of the inline namespace set [[namespace.def]] of those
|
| 554 |
namespaces. Argument-dependent lookup finds all declarations of
|
|
|
|
| 617 |
}
|
| 618 |
```
|
| 619 |
|
| 620 |
— *end example*]
|
| 621 |
|
| 622 |
+
[*Note 4*: The associated namespace can include namespaces already
|
| 623 |
considered by ordinary unqualified lookup. — *end note*]
|
| 624 |
|
| 625 |
[*Example 3*:
|
| 626 |
|
| 627 |
``` cpp
|
|
|
|
| 645 |
|
| 646 |
#### General <a id="basic.lookup.qual.general">[[basic.lookup.qual.general]]</a>
|
| 647 |
|
| 648 |
Lookup of an *identifier* followed by a `::` scope resolution operator
|
| 649 |
considers only namespaces, types, and templates whose specializations
|
| 650 |
+
are types. If a name, *template-id*, *splice-scope-specifier*, or
|
| 651 |
+
*computed-type-specifier* is followed by a `::`, it shall either be a
|
| 652 |
+
dependent *splice-scope-specifier* [[temp.dep.splice]] or it shall
|
| 653 |
+
designate a namespace, class, enumeration, or dependent type, and the
|
| 654 |
+
`::` is never interpreted as a complete *nested-name-specifier*.
|
| 655 |
|
| 656 |
[*Example 1*:
|
| 657 |
|
| 658 |
``` cpp
|
| 659 |
class A {
|
|
|
|
| 690 |
- the terminal name of
|
| 691 |
- a *qualified-id*,
|
| 692 |
- a *using-declarator*,
|
| 693 |
- a *typename-specifier*,
|
| 694 |
- a *qualified-namespace-specifier*, or
|
| 695 |
+
- a *nested-name-specifier*, *reflection-name*,
|
| 696 |
+
*elaborated-type-specifier*, or *class-or-decltype* that has a
|
| 697 |
+
*nested-name-specifier* [[expr.prim.id.qual]].
|
| 698 |
|
| 699 |
The *lookup context* of a member-qualified name is the type of its
|
| 700 |
associated object expression (considered dependent if the object
|
| 701 |
expression is type-dependent). The lookup context of any other qualified
|
| 702 |
name is the type, template, or namespace nominated by the preceding
|