Skip to content

CWG2729 [expr.new] p1 What type a new-type-id denotes is underspecified #237

Closed
cplusplus/draft
#6328
@xmh0511

Description

@xmh0511

Full name of submitter (unless configured in github; will be published with the issue): Jim X

[expr.new] p1 says:

The new-expression attempts to create an object of the type-id ([dcl.name]) or new-type-id to which it is applied.

We clearly define what type a type-id denotes in [dcl.name] p1 and how it is intepreted

To specify type conversions explicitly, and as an argument of sizeof, alignof, new, or typeid, the name of a type shall be specified. This can be done with a type-id, which is syntactically a declaration for a variable or function of that type that omits the name of the entity.

The named type is then the same as the type of the hypothetical identifier.

However, we do not have a similar clause that specifies what type a new-type-id denotes. The syntax new-type-id is only introduced in [expr.new] and we didn't clearly define it.

However, many rules in [expr.new] depends on what type the new-type-id denotes, such as

[expr.new] p7

If the type-id or new-type-id denotes an array type of unknown bound ([dcl.array]),

Suggested resolution

Clearly define what type a new-type-id denotes, and how it is associated with [dcl.array], [dcl.ptr], and [dcl.mptr].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions