Some rules are omitted in [dcl.ptr], [dcl.ref], [dcl.mptr], [dcl.array], [dcl.fct]
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
the type of the declarator-id in D is “derived-declarator-type-list noexcept opt function of parameter-type-list cv-qualifier-seq optref-qualifieropt returning T”, where...
The type of the declarator-id in D is “derived-declarator-type-list noexceptoptfunction of parameter-type-list cv-qualifier-seq optref-qualifieroptreturning U”, where..
A type of either form is a function type.
How about if "derived-declarator-type-list" is not empty(e.g, "pointer to" )? Is it, in either case, a function type? It obviously not. I think it should be:
A type of either form is a function type if the derived-declarator-type-list is empty.
The following rule is used to state what kind of declaration declares a function, It emphasizes that a typedef declaration with function type does not declare a function, which is a lack in the standard.
a function declaration declares a function.
It should have the similar modification for [dcl.ptr], [dcl.ref], [dcl.mptr], [dcl.array].
[dcl.ptr]
the type of the declarator-id in D is “derived-declarator-type-list cv-qualifier-seq pointer to T”.
The type is a pointer type if the derived-declarator-type-list is empty. An object declaration with the pointer type declares a pointer.
[dcl.ref]
the type of the declarator-id in D is “derived-declarator-type-list reference to T”
The type is a reference type if the derived-declarator-type-list is empty. An object declaration with the reference type declares a reference.
[dcl.mptr]
the type of the declarator-id in D is “derived-declarator-type-list cv-qualifier-seq pointer to member of class nested-name-specifier of type T”
The type is a pointer-to-member type if the derived-declarator-type-list is empty. An object declaration with the pointer-to-member type declares a pointer to member.
[dcl.array]
the type of the declarator-id in D is “derived-declarator-type-list array of N T”.
The type is an array type if the derived-declarator-type-list is empty. An object declaration with the array type declares an array.
The above modification together with the following rule simultaneously clarifies that a typedef declaration with a reference type or an object type does not declare a variable, for which I don't find any strong evidence in the current draft; Since there is no rule in the current draft states what is the declaration of a reference or an object.
If the decl-specifier-seq contains no typedef specifier, the declaration is called a function declaration if the type associated with a declarator-id is a function type ([dcl.fct]) and an object declaration otherwise.
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 the quoted wording in [dcl.fct], [dcl.ptr], [dcl.ref], [dcl.mptr], and [dcl.array]. Check how derived-declarator-type-list and typedef declarations are described across these clauses, then verify that the proposed conditions consistently distinguish function, pointer, reference, pointer-to-member, and array types. Done means the wording is internally consistent and the declaration cases are unambiguous.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100