changeset 780:2cf440d511bb

Move tuple syntax copy for function arguments after semantic, to make sure ->ty contains the final value. Fixes run/t/tuple_20_A again.
author Christian Kamm <kamm incasoftware de>
date Sat, 22 Nov 2008 18:45:09 +0100
parents ef7fe998f9b3
children 28d9cbcd7580
files dmd/mtype.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/mtype.c	Sat Nov 22 18:38:13 2008 +0100
+++ b/dmd/mtype.c	Sat Nov 22 18:45:09 2008 +0100
@@ -2951,14 +2951,19 @@
 	{   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))