From 34ea3ded9c1c035b19df40de3d8303377233f6fa Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sat, 25 Oct 2008 10:06:50 +0100 Subject: [PATCH] Assignments in if statements only worked for class/pointer types It tried to turn everything into a maybe type, even ints, etc. --- dmd2/statement.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dmd2/statement.c b/dmd2/statement.c index 479f02c..cd322e4 100644 --- a/dmd2/statement.c +++ b/dmd2/statement.c @@ -2098,8 +2098,10 @@ Statement *IfStatement::semantic(Scope *sc) sym->parent = sc->scopesym; scd = sc->push(sym); - Type *t = arg->type ? arg->type : condition->type; - match = new VarDeclaration(loc, t->maybe(true), arg->ident, NULL); + Type *t = arg->type ? arg->type->semantic(loc, sc) : condition->type; + if (t->ty == Tclass || t->ty == Tpointer) + t = t->maybe(true); + match = new VarDeclaration(loc, t, arg->ident, NULL); match->noauto = 1; match->semantic(scd); if (!scd->insert(match)) -- 2.11.4.GIT