]> Cypherpunks repositories - gostls13.git/commitdiff
bug252: make ... vs ...T crossing an error, at least for now
authorRuss Cox <rsc@golang.org>
Tue, 2 Feb 2010 23:00:13 +0000 (15:00 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 2 Feb 2010 23:00:13 +0000 (15:00 -0800)
R=r
CC=golang-dev
https://golang.org/cl/199066

src/cmd/gc/typecheck.c
test/fixedbugs/bug252.go [new file with mode: 0644]

index 9c06ff6a154859eda48f37f3dba0103b6d344b54..0643f77a953554322ae4b22f17f6447c5fc2b3c0 100644 (file)
@@ -1517,6 +1517,11 @@ typecheckaste(int op, Type *tstruct, NodeList *nl, char *desc)
        for(tl=tstruct->type; tl; tl=tl->down) {
                t = tl->type;
                if(tl->isddd) {
+                       if(nl != nil && nl->n->isddd && !eqtype(nl->n->type, t)) {
+                               // TODO(rsc): This is not actually illegal but will
+                               // help catch bugs.
+                               yyerror("cannot pass %+N as %T (... mismatch)", nl->n, tl);
+                       }
                        if(nl != nil && nl->next == nil && nl->n->isddd && eqtype(nl->n->type, t))
                                goto out;
                        for(; nl; nl=nl->next) {
diff --git a/test/fixedbugs/bug252.go b/test/fixedbugs/bug252.go
new file mode 100644 (file)
index 0000000..7ed8b87
--- /dev/null
@@ -0,0 +1,15 @@
+// errchk $G $D/$F.go
+
+// Copyright 2010 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+func f(args ...) {
+       g(args) // ERROR "[.][.][.] mismatch"
+}
+
+func g(args ...interface{}) {
+       f(args) // ERROR "[.][.][.] mismatch"
+}