code
stringlengths
10
1.34M
language
stringclasses
1 value
// run // Copyright 2009 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 var s [8]string func init() { s = [...]string{ "now", "is", "the", "time", "to", "fix", "this", "bug"} } func main() { }
Go
// compile // Copyright 2009 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 bug063 const c = 0 ^ 0
Go
// $G $D/bug160.dir/x.go && $G $D/bug160.dir/y.go && $L y.$A && ./$A.out // Copyright 2009 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. nothing to see here
Go
// $G $D/$F.dir/bug0.go && $G $D/$F.dir/bug1.go || echo BUG: fails incorrectly // Copyright 2009 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. ignored
Go
// run // Copyright 2009 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. // function call arg reordering was picking out 1 call that // didn't need to be in a temporary, but it was picking // out the first call instead of the...
Go
// errorcheck // Copyright 2009 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 main() { var x int64 = 0; println(x != nil); // ERROR "illegal|incompatible|nil" println(0 != nil); // ERROR "illegal|incomp...
Go
// compile // Copyright 2009 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 main() { if true { } else { L1: goto L1 } if true { } else { goto L2 L2: main() } } /* These should be legal accor...
Go
// 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. // Test case for http://code.google.com/p/go/issues/detail?id=692 package main var fooCount = 0 var barCount = 0 var balCount = 0 func foo() (int, in...
Go
// compile // Copyright 2009 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 main() { var b1 []byte; s1 := string(b1); println(len(s1)); // prints 0 b2 := ([]byte)(nil); s2 := string(b2); println(le...
Go
// run // Copyright 2009 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 var m = map[int]int{0: 0, 1: 0} var nf = 0 var i int func multi() (int, int) { return 1, 2 } func xxx() { var c chan int x, ok := <-c ...
Go
// Copyright 2009 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 bug0 const A = -1
Go
// Copyright 2009 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 bug1 import _ "./bug0"
Go
// errorcheck // Copyright 2009 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 type T int type U int var x int var t T = int(0) // ERROR "cannot use|incompatible" var t1 T = int(x) // ERROR "cannot use|incomp...
Go
// run // Copyright 2011 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 // issue 2337 // The program deadlocked. import "runtime" func main() { runtime.GOMAXPROCS(2) runtime.GC() runtime.GOMAXPROCS(1) }
Go
// errorcheck // Copyright 2011 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. // issue 1993. // error used to have last line number in file package main func bla1() bool { return false } func bla5() bool { _ = 1 fals...
Go
// run // Copyright 2009 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 main() { switch ; { case true: return; default: return } } /* bug003.go:6: fatal error: walkswitch: not case EMPTY */
Go
// errorcheck // Copyright 2009 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 f1() { exit: print("hi\n") goto exit } func f2() { const c = 1234 } func f3() { i := c // ERROR "undef" } func main() {...
Go
// compile // Copyright 2011 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. // issue 2086 // was calling makeclosure twice on the closure package bug354 type Inner struct { F func() error } type Outer struct { Inners [...
Go
// compile // Copyright 2012 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. // Gccgo used to incorrectly give an error when compiling this. package p func F() (i int) { for first := true; first; first = false { i++ } ...
Go
// [ $A != 6 ] || errchk $G -e $D/$F.go // Copyright 2011 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. // Issue 2444 package main func main() { // ERROR "stack frame too large" var arr [1000200030]int arr_bkup := arr...
Go
// 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. // http://code.google.com/p/go/issues/detail?id=589 package main func main() { n := int64(100) x := make([]int, n) x[99] = 234; z := x[n-1] if...
Go
// compile // 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. // This is a test case for issue 788. package main func main() { var a [1]complex64 t := a[0] _ = real(t) // this works _ = real(a[0]) // t...
Go
// compile // Copyright 2009 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 bug219 func f(func()) int { return 0 } // this doesn't work: // bug219.go:16: syntax error near if func g1() { if x := f(func() { if tr...
Go
// 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. package main import ( "errors" "strconv" ) var trace string func f() string { trace += "f" return "abc" } func g() *error { trace += "g" var x...
Go
// compile // Copyright 2011 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. // Used to cause a typechecking loop error. package pkg type T map[int]string var q = &T{}
Go
// compile // Copyright 2009 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 main() { x := false; func () { if x { println(1); } }(); // this does not compile func () { if x == false { println(...
Go
// run // Copyright 2009 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() { v := [...]string{"a", "b"}; _ = v; } func main() { f(); }
Go
// $G -N -o slow.$A $D/bug369.dir/pkg.go && // $G -o fast.$A $D/bug369.dir/pkg.go && // run // Copyright 2011 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. // Test that compiling with optimization turned on produces faster...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out >/dev/null 2>&1 || echo BUG: bug206 // Copyright 2009 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 import "go/ast"; func g(list []ast.Expr) { n := len(list)-1; printl...
Go
// 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. package main import "math" func f() float64 { math.Pow(2, 2) return 1 } func main() { for i := 0; i < 10; i++ { // 386 float register bug used ...
Go
// compile // Copyright 2012 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. // http://code.google.com/p/go/issues/detail?id=3351 package main // struct with four fields of basic type type S struct {a, b, c, d int} // stru...
Go
// 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. package main func f() int { defer func() { recover() }() panic("oops") } func g() int { return 12345 } func main() { g() // leave 12345 on s...
Go
// compile // Copyright 2009 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 bug071 type rat struct { den int; } func (u *rat) pr() { } type dch struct { dat chan *rat; } func dosplit(in *dch){ dat := <-in.d...
Go
// errorcheck // Copyright 2009 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 import "fmt" // GCCGO_ERROR "previous" var fmt int // ERROR "redecl|redefinition"
Go
// 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. // http://code.google.com/p/go/issues/detail?id=589 package main import "unsafe" var bug = false var minus1 = -1 var big int64 = 10 | 1<<32 var g1...
Go
// errorcheck // 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 type I1 interface { m() I2 I2 // GCCGO_ERROR "loop|interface" } type I2 interface { I1 // ERROR "loop|interface" } var i1 I1...
Go
// errorcheck // Copyright 2009 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() int { return 0; } func main() { const n = f(); // ERROR "const" }
Go
// errorcheck // 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 var a [10]int // ok var b [1e1]int // ok var c [1.5]int // ERROR "truncated" var d ["abc"]int // ERROR "invalid array bound|not nu...
Go
// run // Copyright 2009 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 import "fmt" type Buffer int func (*Buffer) Read() {} type Reader interface { Read() } func f() *Buffer { return nil } func g() Read...
Go
// compile // Copyright 2009 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() {} func main() { x := 0; // this compiles switch x { case 0: f(); default: f(); } // this doesn't but it should //...
Go
// compile // Copyright 2009 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 bug151 type S string type Empty interface {} func (v S) Less(e Empty) bool { return v < e.(S); } /* bugs/bug151.go:10: illegal types fo...
Go
// compile // Copyright 2009 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 foo import "fmt" func f() { fmt.Println(); fmt := 1; _ = fmt; }
Go
// compile // Copyright 2009 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 var digits string; func putint(buf []byte, i, base, val int, digits string) { buf[i] = digits[val]; } func main() { } /* uetli:~/...
Go
// $G $D/$F.dir/p1.go && $G $D/$F.dir/p2.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. ignored
Go
// compile // 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 bug250 type I1 interface { m() I2 } type I2 interface { I1 } var i1 I1 = i2 var i2 I2 var i2a I2 = i1
Go
// cmpout // Copyright 2012 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. // Multiple inlined calls to a function that causes // redundant address loads. package main func F(v [2]float64) [2]float64 { return [2]float64{...
Go
// errorcheck // Copyright 2009 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 (x int) { // GCCGO_ERROR "previous" var x int; // ERROR "redecl|redefinition" }
Go
// compile // Copyright 2009 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 type S struct { p *S; s []S; m map[int] S; c chan S; i interface { f(S); }; f func(S) S; } func main() { var s S; s.p = &s; ...
Go
// $G $D/$F.dir/io.go && errchk $G -e $D/$F.dir/main.go // Copyright 2011 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 ignored
Go
// errorcheck // Copyright 2011 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. // Issue 1722. // Check that the error messages says // bug337.go:16: len("foo") not used // and not // bug337.go:16: 3 not used package main...
Go
// Copyright 2012 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 import "./p1" type MyObject struct { p1.Fer } func main() { var b p1.Fer = &p1.Object{} p1.PrintFer(b) va...
Go
// Copyright 2012 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 p1 import "fmt" type Fer interface { f() string } type Object struct {} func (this *Object) f() string { return "Ob...
Go
// run // Copyright 2009 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 type S struct { } func (p *S) M() { } type I interface { M(); } func main() { var p *S = nil; var i I = p; // this should be possib...
Go
// errorcheck // Copyright 2009 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 main() { var x int; x := 0; // ERROR "declar|:=" _ = x; }
Go
// Copyright 2012 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. // Use the functions in one.go so that the inlined // forms get type-checked. package three import "./two" var x = two.F() var v = two.V
Go
// Copyright 2012 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. // Functions that the inliner exported incorrectly. package one type T int // Issue 2678 func F1(T *T) bool { return T == nil } // Issue 2682. func F2(c ch...
Go
// Copyright 2012 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. // Use the functions in one.go so that the inlined // forms get type-checked. package two import "./one" func use() { one.F1(nil) one.F2(nil) one.F3() o...
Go
// run // Copyright 2011 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 type Value struct { X interface{} Y int } type Struct struct { X complex128 } const magic = 1 + 2i func (Value) Complex(x complex12...
Go
// errorcheck // Copyright 2011 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. // issue 2089 - internal compiler error package main import ( "io" "os" ) func echo(fd io.ReadWriterCloser) { // ERROR "undefined.*io.ReadW...
Go
// run // Copyright 2009 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 type A []int func main() { var a [3]A for i := 0; i < 3; i++ { a[i] = A{i} } if a[0][0] != 0 { panic("fail a[0][0]") } if a[1][...
Go
// errorcheck // Copyright 2011 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. // check that compiler doesn't stop reading struct def // after first unknown type. // Fixes issue 2110. package main type S struct { err fo...
Go
// compile // Copyright 2009 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. // Crashes 6g, 8g // http://code.google.com/p/go/issues/detail?id=238 package main func main() { bar := make(chan bool); select { case _ = <-ba...
Go
// run // Copyright 2009 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 import "fmt" func main() { var i, k int var r string outer: for k = 0; k < 2; k++ { r += fmt.Sprintln("outer loop top k", k) if k ...
Go
// errorcheck // Copyright 2009 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() (int, bool) { return 0, true } func main() { x, y := f(), 2; // ERROR "multi" _, _ = x, y }
Go
// run // Copyright 2009 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 const B32 = 1<<32 - 1 const C32 = (-1) & ((1 << 32) - 1) const D32 = ^0 func main() { if B32 != 0xFFFFFFFF { println("1<<32 - 1 is", B...
Go
// $G $D/$F.dir/bug0.go && errchk $G $D/$F.dir/bug1.go // Copyright 2009 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. ignored
Go
// run // Copyright 2009 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 main() { L: for i := 0; i < 1; i++ { L1: for { break L } panic("BUG: not reached - break") if false { goto L1 } } ...
Go
// compile // Copyright 2009 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 swap(x, y int) (u, v int) { return y, x } func main() { a := 1; b := 2; a, b = swap(swap(a, b)); if a != 2 || b != 1 { pa...
Go
// compile // Copyright 2009 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 isuint(i uint) { } func main() { i := ^uint(0); isuint(i); }
Go
// errorcheck // Copyright 2011 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. // issue 1556 package foo type I interface { m() int } type T int var _ I = T(0) // GCCGO_ERROR "incompatible" func (T) m(buf []byte) (a in...
Go
// compile // Copyright 2009 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 type T struct { s string } var t = T{"hi"} func main() {} /* bug112.go:6: illegal conversion of constant to T */
Go
// 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. package main func main() { data := make(map[int]string, 1) data[0] = "hello, " data[0] += "world!" if data[0] != "hello, world!" { panic("BUG: " ...
Go
// errorcheck // Copyright 2009 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 (x, // GCCGO_ERROR "previous" x int) { // ERROR "redeclared|redefinition" "duplicate" }
Go
// compile // Copyright 2012 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. // Used to crash compiler in interface type equality check. package p type I1 interface { F() interface{I1} } type I2 interface { F(...
Go
// compile // 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. // issue 1136 package main import "fmt" func log1(f string, argv ...interface{}) { fmt.Printf("log: %s\n", fmt.Sprintf(f, argv...)) } func mai...
Go
// 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. // issue 1172 package main func main() { var i interface{} c := make(chan int, 1) c <- 1 select { case i = <-c: // error on this line } if i !...
Go
// errorcheck // Copyright 2011 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. // issue 1664 package main func main() { var i uint = 33 var a = (1<<i) + 4.5 // ERROR "shift of type float64|invalid.*shift" println(a) ...
Go
// errorcheck // Copyright 2012 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. // Issue 3044. // Multiple valued expressions in return lists. package p func Two() (a, b int) // F used to compile. func F() (x interface{}, ...
Go
// errorcheck // Copyright 2011 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. // issue 2343 package main type T struct {} func (t *T) pm() {} func (t T) m() {} func main() { p := &T{} p.pm() p.m() q := &p q.m() ...
Go
// compile // Copyright 2009 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. // Used to crash the compiler. // http://code.google.com/p/go/issues/detail?id=88 package main func main() { x := make(map[int]int, 10); x[0], x...
Go
// $G $D/$F.go && $L $F.$A && ! ./$A.out || echo BUG: bug429 // Copyright 2012 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. // Should print deadlock message, not hang. package main func main() { select {} }
Go
// errorcheck // Copyright 2009 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 main() { s := string(bug); // ERROR "undef" }
Go
// errorcheck // 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 type T struct { // legal according to spec x int y (int) int *float64 // not legal according to spec (complex128) // ERROR...
Go
// $G $D/$F.dir/bug0.go && $G $D/$F.dir/bug1.go && errchk $G $D/$F.dir/bug2.go // Copyright 2009 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. ignored
Go
// $G $D/bug191.dir/a.go && $G $D/bug191.dir/b.go && $G $D/$F.go && $L $F.$A // Copyright 2009 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 import . "./a" import . "./b" var _ T var _ V func main() { }
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 p type T struct { X, Y int } type I interface { M(T) }
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 import ( p0 "./bug0" p1 "./bug1" ) // both p0.T and p1.T are struct { X, Y int }. var v0 p0.T var v1 p1.T // interfaces involving the two typ...
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 p type T struct { X, Y int } type I interface { M(T) }
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 import ( p0 "./bug0" p1 "./bug1" "reflect" "strings" ) var v0 p0.T var v1 p1.T type I0 interface { M(p0.T) } type I1 interface { M(p1.T) ...
Go
// 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. // Test order of evaluation in tuple assignments. package main var i byte = 0 var a [30]byte func f() *byte { i++ return &a[i-1] } func gbyte() byt...
Go
// run // Copyright 2009 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 type T struct { i int } func main() { var ta []*T; ta = new([1]*T)[0:]; ta[0] = nil; } /* bug045.go:13: fatal error: goc: exit 1 */
Go
// run // Copyright 2011 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. // issue 1900 package main func getArgs(data map[string]interface{}, keys ...string) map[string]string { ret := map[string]string{} var...
Go
// compile // Copyright 2009 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. // Test case for issue 475. This file should compile. package main import . "unsafe" func main() { var x int println(Sizeof(x)) } /* bug239.go...
Go
// errorcheck // Copyright 2009 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. // check that initialization loop is diagnosed // and that closure cannot be used to hide it. // error message is not standard format, so no errc...
Go
// errorcheck // Copyright 2011 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. // Issue 1871. package p type a interface { foo(x int) (x int) // ERROR "redeclared|redefinition" } var b interface { bar(y int) (y int) //...
Go
// errorcheck // Copyright 2009 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(x int, y ...int) // ok func g(x int, y float) (...) // ERROR "[.][.][.]" "final argument" func h(x, y ...int) // ERROR "...
Go
// compile // Copyright 2012 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. // Gccgo used to crash compiling this. package p type E int func (e E) P() *E { return &e } const ( C1 E = 0 C2 = C1 ) func F() *E { return ...
Go
// errorcheck // 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. // Use //line to set the line number of the next line to 20. //line fixedbugs/bug305.go:20 package p // Introduce an error which should be rep...
Go
// run // Copyright 2009 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 shift(x int) int { return 1 << (1 << (1 << (uint(x)))) } func main() { if n := shift(2); n != 1<<(1<<(1<<2)) { println("bad shift...
Go
// errorcheck // Copyright 2009 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 main() { const a uint64 = 10; var b int64 = a; // ERROR "convert|cannot|incompatible" }
Go