]> Cypherpunks repositories - gostls13.git/commitdiff
don't try interface/structure conversion until
authorRuss Cox <rsc@golang.org>
Tue, 11 Nov 2008 23:55:32 +0000 (15:55 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 11 Nov 2008 23:55:32 +0000 (15:55 -0800)
last resort, because it assumes every call is a
real use of the conversion.

R=ken
OCL=19026
CL=19026

src/cmd/gc/walk.c

index 13ad69a65adab42f6ba7fae1a497495bc6cfd429..e68833c42e6bf87196c41bfcece048f48cae1e31 100644 (file)
@@ -597,13 +597,6 @@ loop:
                if(isptrarray(t) && isptrdarray(l->type))
                        goto ret;
 
-               // interface and structure
-               et = isandss(n->type, l);
-               if(et != Inone) {
-                       indir(n, ifaceop(n->type, l, et));
-                       goto ret;
-               }
-
                // structure literal
                if(t->etype == TSTRUCT) {
                        indir(n, structlit(n));
@@ -624,6 +617,13 @@ loop:
                        goto ret;
                }
 
+               // interface and structure
+               et = isandss(n->type, l);
+               if(et != Inone) {
+                       indir(n, ifaceop(n->type, l, et));
+                       goto ret;
+               }
+
                if(l->type != T)
                        yyerror("cannot convert %T to %T", l->type, t);
                goto ret;