cplusplus / cplusplus/draft

[expr.new] does not specify pointer value in case of an empty array allocation CWG2532

Open
#3,178 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

p5:

When the allocated object is not an array, the result of the new-expression is a pointer to the object created.

p6:

When the allocated object is an array (that is, the noptr-new-declarator syntax is used or the new-type-id or type-id denotes an array type), the new-expression yields a pointer to the initial element (if any) of the array.

p9:

When the value of the expression is zero, the allocation function is called to allocate an array with no elements.

IMO p9 (or p6) should specify what kind of pointer value ([basic.compound]) is produced by a new-expression allocating an array with no elements

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 the cited paragraphs p5, p6, and p9 together with the referenced [basic.compound] pointer-value rules. Check how the draft currently describes a new-expression allocating an array with no elements. Done means the standard wording clearly specifies the resulting pointer value for that case.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.