X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gcc%2Ftestsuite%2Fgo.test%2Ftest%2Fappend.go;h=3f6251ee507668f6ce9828149417e628066472e3;hb=4d8cd3a26294ce35abb17668eac2b6c38dd23bd0;hp=e178f46990d62b613133b17b0f7b56571c9a1228;hpb=c944d49b3bd3667c65c299afd3b1d756084203f4;p=platform%2Fupstream%2Fgcc48.git diff --git a/gcc/testsuite/go.test/test/append.go b/gcc/testsuite/go.test/test/append.go index e178f46..3f6251e 100644 --- a/gcc/testsuite/go.test/test/append.go +++ b/gcc/testsuite/go.test/test/append.go @@ -1,10 +1,10 @@ -// $G $F.go && $L $F.$A && ./$A.out +// run // 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. -// Semi-exhaustive test for append() +// Semi-exhaustive test for the append predeclared function. package main @@ -27,6 +27,7 @@ func main() { } verifyStruct() verifyInterface() + verifyType() } @@ -230,3 +231,17 @@ func verifyInterface() { verify("interface l", append(s), s) verify("interface m", append(s, e...), r) } + +type T1 []int +type T2 []int + +func verifyType() { + // The second argument to append has type []E where E is the + // element type of the first argument. Test that the compiler + // accepts two slice types that meet that requirement but are + // not assignment compatible. The return type of append is + // the type of the first argument. + t1 := T1{1} + t2 := T2{2} + verify("T1", append(t1, t2...), T1{1, 2}) +}