From cb3e057631313e3de1bcb4e6fa5476b7790df2f1 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sat, 22 Nov 2008 18:45:09 +0100 Subject: [PATCH] Move tuple syntax copy for function arguments after semantic, to make sure ->ty contains the final value. Fixes run/t/tuple_20_A again. --- dmd/mtype.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dmd/mtype.c b/dmd/mtype.c index f8ec367a..f14d654b 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -2951,14 +2951,19 @@ Type *TypeFunction::semantic(Loc loc, Scope *sc) { Argument *arg = Argument::getNth(tf->parameters, i); Type *t; - // each function needs its own copy of a tuple arg, since - // they mustn't share arg flags like inreg, ... - if (arg->type->ty == Ttuple) - arg->type = arg->type->syntaxCopy(); - tf->inuse++; arg->type = arg->type->semantic(loc,sc); if (tf->inuse == 1) tf->inuse--; + + // each function needs its own copy of a tuple arg, since + // they mustn't share arg flags like inreg, ... + if (arg->type->ty == Ttuple) { + arg->type = arg->type->syntaxCopy(); + tf->inuse++; + arg->type = arg->type->semantic(loc,sc); + if (tf->inuse == 1) tf->inuse--; + } + t = arg->type->toBasetype(); if (arg->storageClass & (STCout | STCref | STClazy))