{
// limit recursive expansion
static int nest;
- static const int nestLimit = 1000;
- if (nest > nestLimit)
+ if (nest > global.recursionLimit)
{
- error(Loc(), "DDoc macro expansion limit exceeded; more than %d "
- "expansions.", nestLimit);
+ error(Loc(), "DDoc macro expansion limit exceeded; more than %d expansions.",
+ global.recursionLimit);
return;
}
nest++;
void visit(ArrayLiteralExp *e)
{
+ // https://issues.dlang.org/show_bug.cgi?id=20092
+ if (e->elements && e->elements->dim &&
+ e->type->toBasetype()->nextOf()->ty == Tvoid)
+ {
+ result = deduceEmptyArrayElement();
+ return;
+ }
if ((!e->elements || !e->elements->dim) &&
e->type->toBasetype()->nextOf()->ty == Tvoid &&
tparam->ty == Tarray)
static int nest;
// extracted to a function to allow windows SEH to work without destructors in the same function
//printf("%d\n", nest);
- if (++nest > 500)
+ if (++nest > global.recursionLimit)
{
global.gag = 0; // ensure error message gets printed
- error("recursive expansion");
+ error("recursive expansion exceeded allowed nesting limit");
fatal();
}
// extracted to a function to allow windows SEH to work without destructors in the same function
static int nest;
//printf("%d\n", nest);
- if (++nest > 300)
+ if (++nest > global.recursionLimit)
{
global.gag = 0; // ensure error message gets printed
- error("recursive expansion");
+ error("recursive expansion exceeded allowed nesting limit");
fatal();
}
semantic3(sc2);
while (ti && !ti->deferred && ti->tinst)
{
ti = ti->tinst;
- if (++nest > 500)
+ if (++nest > global.recursionLimit)
{
global.gag = 0; // ensure error message gets printed
error("recursive expansion");
static int nest;
//printf("%d\n", nest);
- if (++nest > 500)
+ if (++nest > global.recursionLimit)
{
global.gag = 0; // ensure error message gets printed
error("recursive expansion");
static int nest; // https://issues.dlang.org/show_bug.cgi?id=17380
- if (++nest > 500)
+ if (++nest > global.recursionLimit)
{
::error(e->loc, "cannot resolve identifier `%s`", ident->toChars());
--nest;
bool errors = false;
- if (inuse > 500)
+ if (inuse > global.recursionLimit)
{
inuse = 0;
::error(loc, "recursive type");
#include "init.h"
#include "enum.h"
#include "ctfe.h"
+#include "errors.h"
Expression *semantic(Expression *e, Scope *sc);
v.ret = e;
// Optimize the expression until it can no longer be simplified.
- while (ex != v.ret)
+ size_t b = 0;
+ while (1)
{
+ if (b++ == global.recursionLimit)
+ {
+ e->error("infinite loop while optimizing expression");
+ fatal();
+ }
ex = v.ret;
ex->accept(&v);
+ if (ex == v.ret)
+ break;
}
return ex;
}