[basic.lookup] lookup context vs. cv-qualified that type
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
[basic.lookup.qual.general] p2 define the lookup context:
The lookup context of a member-qualified name is the type of its associated object expression (considered dependent if the object expression is type-dependent). The lookup context of any other qualified name is the type, template, or namespace nominated by the preceding nested-name-specifier.
[basic.lookup.qual.general] p3 states
Qualified name lookup in a class, namespace, or enumeration performs a search of the scope associated with it ([class.member.lookup]) except as specified below.
Consider a case where the type is not a pure class type
struct C{
int c = 0;
};
typedef C const CC;
int main(){
sizeof(CC::c) + CC{}.c;
}
both the lookup context of c is const-qualified class C. [class.member.lookup] just define the lookup process as:
The declaration set is the result of a single search in the scope of C for N from immediately after the class-specifier of C if P is in a complete-class context of C or from P otherwise.
It didn't state what the result is if the lookup context is const C. [class.pre] p1 state
A class is a type.
[basic.type.qualifier] p1 states
Each type other than a function or reference type is part of a group of four distinct, but related, types
[basic.scope.class] p1 states
Any declaration of a class or class template C introduces a class scope
In the above example, the declaration of class C introduces the scope. Maybe, we could arguably say the scope of C is associated with const C.
In addition, [class.member.lookup] also has an unclear definition
[class.member.lookup] p2 states:
The lookup set for N in C, called
S( N, C )consists of two component setsThe declaration set is the result of a single search in the scope of C for N from immediately after the class-specifier of C
From this point, the symbol C should be a class type. However, that symbol in the following two bullets will be interpreted as an object
If the resulting declaration set is not empty, the subobject set contains C itself, and calculation is complete.
Calculate the lookup set for N in each direct non-dependent ([temp.dep.type]) base class subobject Bi and merge each such lookup set S( N, Bi ) in turn into
S( N, C )
Then, [class.member.lookup] p6, in turn, call the second symbol of set S as a class
The result of the search is the declaration set of S( N, T )
where T is previously defined as class or class template T in p1.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing [basic.lookup.qual.general] p2–p3 with [class.member.lookup] p1–p6 and the cited [class.pre], [basic.type.qualifier], and [basic.scope.class] clauses. Trace how the example using const-qualified C is described, then determine how the notation C is intended in the lookup-set bullets. Done means the standard clearly defines the lookup context and consistently distinguishes types, scopes, and subobjects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100