mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Only allow a single D main() function.
Fixes DMD testcase 'fail5634'.
This commit is contained in:
@@ -522,6 +522,11 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||
|
||||
// main
|
||||
if (fdecl->isMain()) {
|
||||
// Detect multiple main functions, which is disallowed. DMD checks this
|
||||
// in the glue code, so we need to do it here as well.
|
||||
if (gIR->mainFunc) {
|
||||
error(fdecl->loc, "only one main function allowed");
|
||||
}
|
||||
gIR->mainFunc = func;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user