Skip to content

Commit 0745893

Browse files
committed
[expression.dd] Add subheadings for *CastExpression*
Add missing *CastQual* anchor.
1 parent a47558e commit 0745893

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

spec/expression.dd

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,17 +1018,22 @@ $(H3 $(LNAME2 cast_expressions, Cast Expressions))
10181018
$(GRAMMAR
10191019
$(GNAME CastExpression):
10201020
$(D cast $(LPAREN)) $(GLINK2 type, Type) $(D $(RPAREN)) $(GLINK UnaryExpression)
1021+
$(I CastQual)
1022+
1023+
$(GNAME CastQual):
10211024
$(D cast $(LPAREN)) $(GLINK2 type, TypeCtors)$(OPT) $(D $(RPAREN)) $(GLINK UnaryExpression)
10221025
)
10231026

10241027
$(P A $(I CastExpression) converts the $(I UnaryExpression)
1025-
to $(GLINK2 type, Type).)
1028+
to $(I Type).)
10261029

10271030
-------------
10281031
cast(foo) -p; // cast (-p) to type foo
10291032
(foo) - p; // subtract p from foo
10301033
-------------
10311034

1035+
$(H3 $(LNAME2 cast_class, Class References))
1036+
10321037
$(P Any casting of a class reference to a
10331038
derived class reference is done with a runtime check to make sure it
10341039
really is a downcast. $(D null) is the result if it isn't.
@@ -1065,6 +1070,8 @@ $(GNAME CastExpression):
10651070
(i.e. a reinterpret cast).
10661071
)
10671072

1073+
$(H3 $(LNAME2 cast_array, Arrays))
1074+
10681075
$(P Casting a dynamic array to another dynamic array is done only if the
10691076
array lengths multiplied by the element sizes match. The cast is done
10701077
as a type paint, with the array length adjusted to match any change in
@@ -1088,6 +1095,8 @@ $(GNAME CastExpression):
10881095
---
10891096

10901097

1098+
$(H3 $(LNAME2 cast_static_array, Static Arrays))
1099+
10911100
$(P Casting a static array to another static array is done only if the
10921101
array lengths multiplied by the element sizes match; a mismatch
10931102
is illegal.
@@ -1112,6 +1121,8 @@ $(GNAME CastExpression):
11121121
}
11131122
---
11141123

1124+
$(H3 $(LNAME2 cast_floating, Floating Point))
1125+
11151126
$(P Casting a floating point literal from one type to another
11161127
changes its type, but internally it is retained at full
11171128
precision for the purposes of constant folding.)
@@ -1162,13 +1173,17 @@ $(GNAME CastExpression):
11621173
}
11631174
---
11641175

1176+
$(H3 $(LNAME2 cast_struct, Struct))
1177+
11651178
$(P Casting a value $(I v) to a struct $(I S), when value is not a struct
11661179
of the same type, is equivalent to:)
11671180

11681181
---
11691182
S(v)
11701183
---
11711184

1185+
$(H3 $(LNAME2 cast_qualifier, Qualifier Cast))
1186+
11721187
$(P Casting to a $(GLINK CastQual) replaces the qualifiers to the type of
11731188
the $(GLINK UnaryExpression).)
11741189

@@ -1177,7 +1192,7 @@ $(GNAME CastExpression):
11771192
assert(is(typeof(cast(const)x) == const int));
11781193
---
11791194

1180-
$(P Casting with no $(GLINK2 type, Type) or $(GLINK CastQual) removes
1195+
$(P Casting with no type or qualifiers removes
11811196
any top level $(D const), $(D immutable), $(D shared) or $(D inout)
11821197
type modifiers from the type
11831198
of the $(GLINK UnaryExpression).)
@@ -1187,6 +1202,8 @@ $(GNAME CastExpression):
11871202
assert(is(typeof(cast()x) == int));
11881203
---
11891204

1205+
$(H3 $(LNAME2 cast_void, Casting to `void`))
1206+
11901207
$(P Casting an expression to $(D void) type is allowed to mark that
11911208
the result is unused. On $(GLINK2 statement, ExpressionStatement),
11921209
it could be used properly to avoid "has no effect" error.)

0 commit comments

Comments
 (0)