cplusplus / cplusplus/draft

[basic.scope.pdecl] What is the locus of a function-definition?

Open
#5,281 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

The subclause [basic.scope.pdecl] does not explicitly mention the locus of a function-definition. Presumably, [basic.scope.pdecl] p1 intends to cover this case but it is incorrect

The locus of a declaration ([basic.pre]) that is a declarator is immediately after the complete declarator ([dcl.decl]).

is means they are identical or they are the same thing. Even though the formal example is not consistent with the utterance

unsigned char x = x;

unsigned char x = x; is the whole declaration whose declarator is merely the first x which is a declarator-id, they are not the same thing. The improvement to this bullet is that:

The locus of a declaration ([basic.pre]) that contains a declarator is immediately after the complete declarator ([dcl.decl]).

This change may clarify the fist example, and it can also cover the function-definition

  • attribute-specifier-seqoptdecl-specifier-seqopt declarator virt-specifier-seq opt function-body
  • attribute-specifier-seqopt decl-specifier-seqopt declarator requires-clause function-body

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading subclause [basic.scope.pdecl] p1 and the definition of locus, then compare the unsigned char x = x; example with the function-definition grammar shown in the issue. Check the surrounding discussion before changing the wording. Done means the clause accurately distinguishes declarations from declarators and explicitly covers function-definitions.

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
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.