Skip to content

Commit 19c29c7

Browse files
committed
Move CastQual grammar to relevant section & tweak some wording
1 parent 0745893 commit 19c29c7

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

spec/expression.dd

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,10 +1018,7 @@ $(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):
1024-
$(D cast $(LPAREN)) $(GLINK2 type, TypeCtors)$(OPT) $(D $(RPAREN)) $(GLINK UnaryExpression)
1021+
$(GLINK CastQual)
10251022
)
10261023

10271024
$(P A $(I CastExpression) converts the $(I UnaryExpression)
@@ -1184,8 +1181,13 @@ $(H3 $(LNAME2 cast_struct, Struct))
11841181

11851182
$(H3 $(LNAME2 cast_qualifier, Qualifier Cast))
11861183

1187-
$(P Casting to a $(GLINK CastQual) replaces the qualifiers to the type of
1188-
the $(GLINK UnaryExpression).)
1184+
$(GRAMMAR
1185+
$(GNAME CastQual):
1186+
$(D cast $(LPAREN)) $(GLINK2 type, TypeCtors)$(OPT) $(D $(RPAREN)) $(GLINK UnaryExpression)
1187+
)
1188+
1189+
$(P A $(I CastQual) replaces the qualifiers in the type of
1190+
the $(I UnaryExpression):)
11891191

11901192
---
11911193
shared int x;
@@ -1195,7 +1197,7 @@ $(H3 $(LNAME2 cast_qualifier, Qualifier Cast))
11951197
$(P Casting with no type or qualifiers removes
11961198
any top level $(D const), $(D immutable), $(D shared) or $(D inout)
11971199
type modifiers from the type
1198-
of the $(GLINK UnaryExpression).)
1200+
of the $(I UnaryExpression).)
11991201

12001202
---
12011203
shared int x;
@@ -1206,13 +1208,13 @@ $(H3 $(LNAME2 cast_void, Casting to `void`))
12061208

12071209
$(P Casting an expression to $(D void) type is allowed to mark that
12081210
the result is unused. On $(GLINK2 statement, ExpressionStatement),
1209-
it could be used properly to avoid "has no effect" error.)
1211+
it could be used properly to avoid a "has no effect" error.)
12101212

12111213
----
12121214
void foo(lazy void exp) {}
12131215
void main()
12141216
{
1215-
foo(10); // NG - has no effect in expression '10'
1217+
foo(10); // NG - expression '10' has no effect
12161218
foo(cast(void)10); // OK
12171219
}
12181220
----

0 commit comments

Comments
 (0)