Skip to content

Commit 8e92e6d

Browse files
committed
[spec] main can be declared with auto or noreturn
1 parent a47558e commit 8e92e6d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

spec/function.dd

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2957,14 +2957,19 @@ $(H2 $(LNAME2 main, $(D main()) Function))
29572957
It gets called after all the module initializers are run, and
29582958
after any unittests are run.
29592959
After it returns, all the module destructors are run.
2960-
$(D main()) must be declared using one of the following forms:
2960+
$(D main()) must be declared as follows:
29612961
)
29622962

2963-
$(UL
2964-
$(LI `void main() { ... }`)
2965-
$(LI `void main(string[] args) { ... }`)
2966-
$(LI `int main() { ... }`)
2967-
$(LI `int main(string[] args) { ... }`)
2963+
$(GRAMMAR
2964+
$(GNAME MainFunction):
2965+
$(GLINK MainReturnDecl) main $(D $(LPAREN)$(RPAREN)) $(GLINK2 statement, BlockStatement)
2966+
$(GLINK MainReturnDecl) main $(D $(LPAREN)string[] args$(RPAREN)) $(GLINK2 statement, BlockStatement)
2967+
2968+
$(GNAME MainReturnDecl):
2969+
$(D void)
2970+
$(D int)
2971+
$(GLINK2 type, noreturn)
2972+
$(RELATIVE_LINK2 auto-functions, $(D auto))
29682973
)
29692974

29702975
$(P The main function must have D linkage.)

0 commit comments

Comments
 (0)