Files
2025-10-25 03:02:53 +03:00

4.9 KiB
Raw Permalink Blame History

[dcl.name]

9 Declarations [dcl]

9.3 Declarators [dcl.decl]

9.3.2 Type names [dcl.name]

1

#

To specify type conversions explicitly,and as an argument ofsizeof,alignof,new, ortypeid, the name of a type shall be specified.

This can be done with atype-id or new-type-id ([expr.new]), which is syntactically a declaration for a variable or function of that type that omits the name of the entity.

type-id:
type-specifier-seq abstract-declaratoropt

defining-type-id:
defining-type-specifier-seq abstract-declaratoropt

abstract-declarator:
ptr-abstract-declarator
noptr-abstract-declaratoropt parameters-and-qualifiers trailing-return-type
abstract-pack-declarator

ptr-abstract-declarator:
noptr-abstract-declarator
ptr-operator ptr-abstract-declaratoropt

noptr-abstract-declarator:
noptr-abstract-declaratoropt parameters-and-qualifiers
noptr-abstract-declaratoropt [ constant-expressionopt ] attribute-specifier-seqopt
( ptr-abstract-declarator )

abstract-pack-declarator:
noptr-abstract-pack-declarator
ptr-operator abstract-pack-declarator

noptr-abstract-pack-declarator:
noptr-abstract-pack-declarator parameters-and-qualifiers
...

It is possible to identify uniquely the location in theabstract-declarator where the identifier would appear if the construction were a declarator in a declaration.

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

[Example 1:

int // int iint * // int *piint *[3] // int p[3]int ()[3] // int (*p3i)[3]int *() // int f()int ()(double) // int (*pf)(double) name respectively the types “int”, “pointer toint”, “array of 3 pointers toint”, “pointer to array of 3int”, “function of (no parameters) returning pointer toint”, and “pointer to a function of (double) returningint”.

— end example]

2

#

[Note 1:

A type can also be named by a typedef-name, which is introduced by a typedef declaration or alias-declaration ([dcl.typedef]).

— end note]