Skip to content

Commit

Permalink
D2: warn about static array parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jul 29, 2014
1 parent 26912c8 commit c4c1c8d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mtype.c
Expand Up @@ -49,6 +49,7 @@
#include "import.h"
#include "aggregate.h"
#include "hdrgen.h"
#include "module.h"

FuncDeclaration *hasThis(Scope *sc);

Expand Down Expand Up @@ -2969,6 +2970,7 @@ Type *TypeFunction::semantic(Loc loc, Scope *sc)
if (tf->inuse == 1) tf->inuse--;

Type *t = fparam->type->toBasetype();
printf("t = %s\n", t->toChars());

This comment has been minimized.

Copy link
@9rnsr

9rnsr Jul 29, 2014

Contributor

Remains printf for debugging.


if (fparam->storageClass & (STCout | STCref | STClazy))
{
Expand Down Expand Up @@ -3020,6 +3022,12 @@ Type *TypeFunction::semantic(Loc loc, Scope *sc)
i--;
continue;
}

if (global.params.Dversion >= 3 && sc->module && sc->module->isRoot() &&
t->ty == Tsarray)
{
warning(loc, "D2 passes static arrays by value, use %s[] instead", t->next->toChars());
}
}
argsc->pop();
}
Expand Down

0 comments on commit c4c1c8d

Please sign in to comment.