From 0616c8985bcc2c179e879e5e357e504a9661bb5c Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Mon, 29 Sep 2008 22:03:27 +0100 Subject: [PATCH] Fix compiler crash doing semantic on a function literal after errors If there are global errors, we don't do semantic2, but then we do some following work that causes a crash. e.g. this crashes the compiler: void main2() { 1; function {1;}; } --- dmd2/func.c | 3 +++ dmd2/parse.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dmd2/func.c b/dmd2/func.c index 63d44f4..b0adf7b 100644 --- a/dmd2/func.c +++ b/dmd2/func.c @@ -123,6 +123,9 @@ void FuncDeclaration::semantic(Scope *sc) if (!originalType) originalType = type; + + type = type->semantic(loc, sc); + if (!type->deco && type->nextOf()) { #if 1 diff --git a/dmd2/parse.c b/dmd2/parse.c index 4b9ec7b..c7d5294 100644 --- a/dmd2/parse.c +++ b/dmd2/parse.c @@ -4997,8 +4997,8 @@ Expression *Parser::parsePrimaryExp() } else { - parseContracts(fd); - } + parseContracts(fd); + } e = new FuncExp(loc, fd); break; } -- 2.11.4.GIT