close
Skip to content

Commit 25d4d7d

Browse files
Document array decay and function decay (#165)
And also clarify the structure of cast expressions and relationships to dyadic operators.
1 parent f658437 commit 25d4d7d

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

‎ltx/exprs.tex‎

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ \subsection{\valueTag{ExprSort::Cast}}
863863
\label{sec:ifc:ExprSort:Cast}
864864

865865
An \type{ExprIndex} value with tag \valueTag{ExprSort::Cast} designates a conversion operation.
866-
The conversion may be explicit (in the input source code) and implicit (as required by semantics analysis).
866+
The conversion may be explicit (in the input source code), or implicit (as required by semantic analysis).
867867
The \field{index} field of this abstract reference is a position into the partition of cast expressions.
868868
Each entry in that partition is a structure with the following layout
869869
%
@@ -882,7 +882,9 @@ \subsection{\valueTag{ExprSort::Cast}}
882882
%
883883
The \field{source} field denotes the operand expression, whereas the \field{target} field denotes
884884
the type to convert that expression to. The \field{operator} designates the sort of conversion operation
885-
to perform.
885+
to perform, which is conceptually a dyadic operator (\secref{sec:ifc:OperatorSort:Dyadic}). This representation
886+
is to be used for all conversion or coercion operations as it does not necessitate
887+
an additional indirection for obtaining the target type.
886888

887889
\partition{expr.cast}
888890

@@ -1884,6 +1886,8 @@ \subsection{Monadic operators}
18841886
\enumerator{Artificial}
18851887
\enumerator{MetaDescriptor}
18861888
\enumerator{Suffix}
1889+
\enumerator{DecayArray}
1890+
\enumerator{DecayFunction}
18871891

18881892
\setcounter{enumi}{1023}
18891893
\enumerator{Msvc}
@@ -2007,6 +2011,11 @@ \subsection{Monadic operators}
20072011
\ifcSortSection{MetaDescriptor}{MonadicOperator} A notional operator indicating that the operand (a \sortref{NamedDecl}{ExprSort})
20082012
designates the RTTI object (the runtime type descriptor) for a type \type{T}. The type of the runtime type descriptor object is \type{T}.
20092013
\ifcSortSection{Suffix}{MonadicOperator} Indicator of a literal operator applied (as suffix) to a string literal (\sortref{String}{ExprSort}).
2014+
\ifcSortSection{DecayArray}{MonadicOperator} The abstract machine operation of converting an expression of type "array of $N$ \code{T}"
2015+
or "array of unknown bound of \code{T}" to a prvalue of type "pointer to \code{T}".
2016+
\ifcSortSection{DecayFunction}{MonadicOperator} The abstract machine operation of converting an lvalue of function type \code{T} to a prvalue of
2017+
type "pointer to \code{T}".
2018+
20102019

20112020
\ifcSortSection{Msvc}{MonadicOperator} This is a marker, not an actual operator. Monadic operators with
20122021
value greater that this are MSVC extensions.
@@ -2412,18 +2421,22 @@ \subsection{Dyadic operators}
24122421
\ifcSortSection{Qualification}{DyadicOperator}
24132422
Abstract machine operation corresponding to implicit cv-qualification of the type of the expression,
24142423
e.g. as in from ``\code{T}'' to ``\code{const T}''.
2424+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
24152425

24162426
\ifcSortSection{Promote}{DyadicOperator}
24172427
Abstract machine operation corresponding to integral or floating point promotion at the source level.
2418-
See also \sortref{Demote}{DyadicOperator}.
2428+
See also \sortref{Demote}{DyadicOperator}. This operator may be referenced by a \sortref{Cast}{ExprSort}
2429+
structure.
24192430

24202431
\ifcSortSection{Demote}{DyadicOperator}
24212432
Abstract machine operation corresponding to the inverse of an integral or floating point promotion at the source level.
2422-
See also \sortref{Promote}{DyadicOperator}.
2433+
See also \sortref{Promote}{DyadicOperator}. This operator may be referenced by a \sortref{Cast}{ExprSort}
2434+
structure.
24232435

24242436
\ifcSortSection{Coerce}{DyadicOperator}
24252437
Abstract machine operation corresponding to an implicit conversion at the source level that is neither
24262438
a promotion (\sortref{Promote}{DyadicOperator}) nor a demotion (\sortref{Demote}{DyadicOperator}).
2439+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
24272440

24282441
\ifcSortSection{Rewrite}{DyadicOperator}
24292442
Abstract machine operation where the semantics of the first operand (source-level construct) is defined by that of the second operand.
@@ -2433,35 +2446,45 @@ \subsection{Dyadic operators}
24332446
Note that this operation is not a placement-new operator (which would entail running a constructor).
24342447

24352448
\ifcSortSection{Cast}{DyadicOperator}
2436-
A C-style cast operation, e.g. ``\code{T)x}''
2449+
A C-style cast operation, e.g. ``\code{(T)x}''
2450+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
24372451

24382452
\ifcSortSection{ExplicitConversion}{DyadicOperator}
2439-
A functional cast notation, e.g. ``\code{T(x)}''.
2453+
A functional cast notation, e.g. ``\code{T(x)}'' at the source level.
2454+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
24402455

24412456
\ifcSortSection{ReinterpretCast}{DyadicOperator}
24422457
Source level operator ``\code{reinterpret\_cast}''.
2458+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
24432459

24442460
\ifcSortSection{StaticCast}{DyadicOperator}
24452461
Source level operator ``\code{static\_cast}''.
2462+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
2463+
24462464

24472465
\ifcSortSection{ConstCast}{DyadicOperator}
24482466
Source level operator ``\code{const\_cast}''.
2467+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
24492468

24502469
\ifcSortSection{DynamicCast}{DyadicOperator}
24512470
Source level operator ``\code{dynamic\_cast}''.
2471+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
24522472

24532473
\ifcSortSection{Narrow}{DyadicOperator}
24542474
Abstract machine operation corresponding to the runtime-checked conversion of a pointer of type ``\code{B*}''
24552475
(or reference of type ``\code{B\&}'') to a pointer of type ``\code{D*}'' (or reference of type ``\code{D\&}'')
24562476
where the class ``\code{D}'' is a derived class of ``\code{B}''.
2477+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
24572478

24582479
\ifcSortSection{Widen}{DyadicOperator}
24592480
Abstract machine operation corresponding to the implicit conversion of a pointer of type ``\code{D*}'' (or
24602481
reference of type ``\code{D\&}'') to a pointer of type ``\code{B*}'' (or a reference of type ``\code{B&}''),
24612482
where the class ``\code{D}'' is a derived class of ``\code{B}''.
2483+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
24622484

24632485
\ifcSortSection{Pretend}{DyadicOperator}
2464-
Abstract machine operation generalizing \code{bitcat} and \code{rinterpret\_cast}.
2486+
Abstract machine operation generalizing \code{bitcat} and \code{reinterpret\_cast}.
2487+
This operator may be referenced by a \sortref{Cast}{ExprSort} structure.
24652488

24662489
\ifcSortSection{Closure}{DyadicOperator}
24672490
Abstract machine operation pairing a function pointer (the second operand) and an environment of captured variables (the first operand)

0 commit comments

Comments
 (0)