cplusplus / cplusplus/draft

[dcl.fct.def.general] p2 "declarator;" is not described in [dcl.fct]

Open
#5,539 2 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

[dcl.fct.def.general] p2 says

In a function-definition, either void declarator ; or declarator ; shall be a well-formed function declaration as described in [dcl.fct].

The latter form declarator ; presumably refers to the declaration of a constructor or destructor. However, it is not described in [dcl.fct]. In [dcl.fct], the declaration described in either [dcl.fct] p1 or p2 should have the form T D; where T should comprise a valid type since the function type "returning T", in either form. This option has confirmed in https://github.com/cplusplus/draft/pull/4737#discussion_r785042207

Constructors / destructors don't have a return type in the "function declaration" sense, and that absence makes "return something" syntactically ill-formed.

So, for the latter case, it should cross-reference [class.ctor] and [class.dtor] instead of [dcl.fct].

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 with [dcl.fct.def.general] p2 and compare the declaration forms described in [dcl.fct] p1-p2. Check [class.ctor] and [class.dtor] for the appropriate constructor and destructor wording. Done means the latter form is cross-referenced to those clauses rather than [dcl.fct].

Written by the indexing model from the issue text.

Assessment

Tech stack
tex
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.