Annex A (informative)
Grammar summary
[gram]
A.5
Expressions
[gram.expr]
primary-expression
:
literal
this
(
expression
)
id-expression
lambda-expression
fold-expression
requires-expression
id-expression
:
unqualified-id
qualified-id
pack-index-expression
unqualified-id
:
identifier
operator-function-id
conversion-function-id
literal-operator-id
~
type-name
~
computed-type-specifier
template-id
qualified-id
:
nested-name-specifier
template
o
p
t
unqualified-id
nested-name-specifier
:
::
type-name
::
namespace-name
::
computed-type-specifier
::
nested-name-specifier
identifier
::
nested-name-specifier
template
o
p
t
simple-template-id
::
pack-index-expression
:
id-expression
.
.
.
[
constant-expression
]
lambda-expression
:
lambda-introducer
attribute-specifier-seq
o
p
t
lambda-declarator
compound-statement
lambda-introducer
<
template-parameter-list
>
requires-clause
o
p
t
attribute-specifier-seq
o
p
t
lambda-declarator
compound-statement
lambda-introducer
:
[
lambda-capture
o
p
t
]
lambda-declarator
:
lambda-specifier-seq
noexcept-specifier
o
p
t
attribute-specifier-seq
o
p
t
trailing-return-type
o
p
t
noexcept-specifier
attribute-specifier-seq
o
p
t
trailing-return-type
o
p
t
trailing-return-type
o
p
t
(
parameter-declaration-clause
)
lambda-specifier-seq
o
p
t
noexcept-specifier
o
p
t
attribute-specifier-seq
o
p
t
trailing-return-type
o
p
t
requires-clause
o
p
t
lambda-specifier
:
consteval
constexpr
mutable
static
lambda-specifier-seq
:
lambda-specifier
lambda-specifier
lambda-specifier-seq
lambda-capture
:
capture-default
capture-list
capture-default
,
capture-list
capture-default
:
&
=
capture-list
:
capture
capture-list
,
capture
capture
:
simple-capture
init-capture
simple-capture
:
identifier
.
.
.
o
p
t
&
identifier
.
.
.
o
p
t
this
*
this
init-capture
:
.
.
.
o
p
t
identifier
initializer
&
.
.
.
o
p
t
identifier
initializer
fold-expression
:
(
cast-expression
fold-operator
.
.
.
)
(
.
.
.
fold-operator
cast-expression
)
(
cast-expression
fold-operator
.
.
.
fold-operator
cast-expression
)
fold-operator
:
one of
+
-
*
/
%
^
&
|
<
<
>
>
+
=
-
=
*
=
/
=
%
=
^
=
&
=
|
=
<
<
=
>
>
=
=
=
=
!
=
<
>
<
=
>
=
&
&
|
|
,
.
*
-
>
*
requires-expression
:
requires
requirement-parameter-list
o
p
t
requirement-body
requirement-parameter-list
:
(
parameter-declaration-clause
)
requirement-body
:
{
requirement-seq
}
requirement-seq
:
requirement
requirement
requirement-seq
requirement
:
simple-requirement
type-requirement
compound-requirement
nested-requirement
simple-requirement
:
expression
;
type-requirement
:
typename
nested-name-specifier
o
p
t
type-name
;
compound-requirement
:
{
expression
}
noexcept
o
p
t
return-type-requirement
o
p
t
;
return-type-requirement
:
-
>
type-constraint
nested-requirement
:
requires
constraint-expression
;
postfix-expression
:
primary-expression
postfix-expression
[
expression-list
o
p
t
]
postfix-expression
(
expression-list
o
p
t
)
simple-type-specifier
(
expression-list
o
p
t
)
typename-specifier
(
expression-list
o
p
t
)
simple-type-specifier
braced-init-list
typename-specifier
braced-init-list
postfix-expression
.
template
o
p
t
id-expression
postfix-expression
-
>
template
o
p
t
id-expression
postfix-expression
+
+
postfix-expression
-
-
dynamic_
cast
<
type-id
>
(
expression
)
static_
cast
<
type-id
>
(
expression
)
reinterpret_
cast
<
type-id
>
(
expression
)
const_
cast
<
type-id
>
(
expression
)
typeid
(
expression
)
typeid
(
type-id
)
expression-list
:
initializer-list
unary-expression
:
postfix-expression
unary-operator
cast-expression
+
+
cast-expression
-
-
cast-expression
await-expression
sizeof
unary-expression
sizeof
(
type-id
)
sizeof
.
.
.
(
identifier
)
alignof
(
type-id
)
noexcept-expression
new-expression
delete-expression
unary-operator
:
one of
*
&
+
-
!
~
await-expression
:
co_await
cast-expression
noexcept-expression
:
noexcept
(
expression
)
new-expression
:
::
o
p
t
new
new-placement
o
p
t
new-type-id
new-initializer
o
p
t
::
o
p
t
new
new-placement
o
p
t
(
type-id
)
new-initializer
o
p
t
new-placement
:
(
expression-list
)
new-type-id
:
type-specifier-seq
new-declarator
o
p
t
new-declarator
:
ptr-operator
new-declarator
o
p
t
noptr-new-declarator
noptr-new-declarator
:
[
expression
o
p
t
]
attribute-specifier-seq
o
p
t
noptr-new-declarator
[
constant-expression
]
attribute-specifier-seq
o
p
t
new-initializer
:
(
expression-list
o
p
t
)
braced-init-list
delete-expression
:
::
o
p
t
delete
cast-expression
::
o
p
t
delete
[
]
cast-expression
cast-expression
:
unary-expression
(
type-id
)
cast-expression
pm-expression
:
cast-expression
pm-expression
.
*
cast-expression
pm-expression
-
>
*
cast-expression
multiplicative-expression
:
pm-expression
multiplicative-expression
*
pm-expression
multiplicative-expression
/
pm-expression
multiplicative-expression
%
pm-expression
additive-expression
:
multiplicative-expression
additive-expression
+
multiplicative-expression
additive-expression
-
multiplicative-expression
shift-expression
:
additive-expression
shift-expression
<
<
additive-expression
shift-expression
>
>
additive-expression
compare-expression
:
shift-expression
compare-expression
<
=
>
shift-expression
relational-expression
:
compare-expression
relational-expression
<
compare-expression
relational-expression
>
compare-expression
relational-expression
<
=
compare-expression
relational-expression
>
=
compare-expression
equality-expression
:
relational-expression
equality-expression
=
=
relational-expression
equality-expression
!
=
relational-expression
and-expression
:
equality-expression
and-expression
&
equality-expression
exclusive-or-expression
:
and-expression
exclusive-or-expression
^
and-expression
inclusive-or-expression
:
exclusive-or-expression
inclusive-or-expression
|
exclusive-or-expression
logical-and-expression
:
inclusive-or-expression
logical-and-expression
&
&
inclusive-or-expression
logical-or-expression
:
logical-and-expression
logical-or-expression
|
|
logical-and-expression
conditional-expression
:
logical-or-expression
logical-or-expression
?
expression
:
assignment-expression
yield-expression
:
co_yield
assignment-expression
co_yield
braced-init-list
throw-expression
:
throw
assignment-expression
o
p
t
assignment-expression
:
conditional-expression
yield-expression
throw-expression
logical-or-expression
assignment-operator
initializer-clause
assignment-operator
:
one of
=
*
=
/
=
%
=
+
=
-
=
>
>
=
<
<
=
&
=
^
=
|
=
expression
:
assignment-expression
expression
,
assignment-expression
constant-expression
:
conditional-expression