code
stringlengths
10
1.34M
language
stringclasses
1 value
// 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 func main() { x := []uint{0} x[0] &^= f() } func f() uint { return 1<<31 // doesn't panic with 1<<31 - 1 }
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 . "testing" // defines top-level T type S struct { T int } func main() { _ = &S{T: 1} // should work }
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 1606. package main func main() { var x interface{} switch t := x.(type) { case 0: // ERROR "type" t.x = 1 // ERROR "type interf...
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
// 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 bug118 func Send(c chan int) int { select { default: return 1; } return 2; }
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
// 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() { s := 0; for _, v := range []int{1} { s += v; } if s != 1 { println("BUG: s =", s); } }
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. package main import "unsafe" func main() { var x int a := uint64(uintptr(unsafe.Pointer(&x))) b := uint32(uintptr(unsafe.Pointer(&x))) c :=...
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 A []int; type M map[int] int; func main() { var a *A = &A{0}; var m *M = &M{0 : 0}; // should be legal to use & here for cons...
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 P const a = 0; func f(a int) { a = 0; } /* bug161.go:8: operation LITERAL not allowed in assignment context */
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 { x, y *T } func main() { // legal composite literals _ = struct{}{} _ = [42]int{} _ = [...]int{} _ = []int{}...
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() { s1 := "hi"; s2 := "ho"; s1 += s2; }
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 package bug235 type T struct { x [4]byte } var p *T var v = *p
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
// 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
// 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 import ( "./p" ) type Exported interface { private() } type Implementation struct{} func (p *Implementation) private() {} func 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 p type Exported interface { private() } type Implementation struct{} func (p *Implementation) private() { println("p.Implementation.private()") } v...
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=662 package main import "fmt" func f() (int, int) { return 1, 2 } func main() { s := fmt.Sprint(f(...
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 {a, b int}; func println(x, y int) { } func f(x interface{}) interface{} { type T struct {a, b int}; if x == nil { re...
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
// $G $D/$F.dir/pkg.go && $G $D/$F.go || echo "Bug 382" // 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 2529 package main import "./pkg" var x = pkg.E var fo = struct {F pkg.T}{F: x}
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 x uint; println(1<<x); }
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 "fmt" var x = uint32(0x01020304) var y = [...]uint32{1,2,3,4,5} func main() { fmt.Sprint(y[byte(x)]) }
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. package main type T int func (T) m() {} // GCCGO_ERROR "previous" func (T) m() {} // ERROR "T[.]m redeclared|redefinition" func (*T) p() {} /...
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 "os" func main() { ok := true; var a, b, c, x, y, z int; f := func() int { b--; return -b }; // this fails on 6g: apparently ...
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 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 . "unsafe" // ERROR "not used" func main() { var x int println(unsafe.Sizeof(x)) // ERROR "undefined" } /* After a '.' i...
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() { var i int; i = '\''; i = '\\'; var s string; s = "\""; _, _ = i, s; } /* bug.go:5: unknown escape sequence: ' bug.go:6...
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 { m map[int]int } func main() { t := new(T); t.m = make(map[int]int); var x int; var ok bool; x, ok = t.m[0]; //bug075...
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 pkg type T struct {} var E T
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 false: return; } // compiles; should be an error (should be simplevardecl before ;) }
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
// 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 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
// 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 type I interface { m(a, b, c, d, e, f, g, h byte) } type Int8 int8 func (x Int8) m(a, b, c, d, e, f, g, h byte) { check("Int8", int64...
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
// 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 const c = 3 var x = c.String() // ERROR "String"
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 2231 package main import "runtime" func foo(runtime.UintType, i int) { // ERROR "cannot declare name runtime.UintType|named/anonymou...
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 bug109 func f(a float64) float64 { e := 1.0 e = e * a return e } /* 6g bugs/bug109.go bugs/bug109.go:5: illegal types for operand: MUL ...
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 A []int; func main() { a := &A{0}; b := &A{0, 1}; _, _ = a, b; } /* uetli:~/Source/go1/test/bugs gri$ 6g bug096.go && 6l bug...
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 run 6g out of registers. Issue 2669. package p type y struct { num int } func zzz () { k := make([]byte, 10) arr := make ([]*y...
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 type S1 struct { i int } type S2 struct { i int } type S3 struct { S1 S2 } type S4 struct { S3 S1 } func main() { var s4 S4 if s...
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 . "fmt" func b() { Println() }
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 "fmt" func a() { fmt.DoesNotExist() // ERROR "undefined" }
Go
// cmpout // 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 import "unsafe" func main() { var p unsafe.Pointer println(p) }
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. package main var x int func main() { (x) := 0 // ERROR "non-name [(]x[)]|non-name on left side" }
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 := uint(10) ss := 1 << s y1 := float64(ss) y2 := float64(1 << s) // ERROR "shift" y3 := string(1 << s) // ERR...
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 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 // Check that the export information is correct in p.6. import _ "./p" // Check that it's still correct in pp.a (which contains p.6). import _ "...
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 { x1 int x2 int x3 int x4 int x5 int x6 int x7 int x8 int x9 int x10 int x11 int x12 int x13 int x14 int x15 int x16 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. package main // type T int func main() {} // issue 1474 // important: no newline on end of next line. // 6g used to print <epoch> instead of...
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 issue 789. The bug only appeared for GOARCH=386. package main func main() { i := 0 x := 0 a := (x & 1) << uint(1-i) s := uint(...
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
// 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 b type T interface{} func f() T { return nil } var Foo T = 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. package a import "./b" var Bar = b.Foo
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. // Some indirect uses of types crashed gccgo, because it assumed that // the size of the type was known before it had been computed. package p typ...
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 ( nf int x, y, z = f(), f(), f() m = map[string]string{"a": "A"} a, aok = m["a"] b, bok = m["b"] ) func look(s str...
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 1979 // used to get internal compiler error too package main import ( "io/ioutil" // GCCGO_ERROR "imported and not used" "net/http"...
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() { // 6g used to compile these as two different // hash codes so it missed the duplication // and worse, compiled the...
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. // issue 2672 // was trying binary search with an interface type package bug393 func f(x interface{}) int { switch x { case 1: return 1 case...
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. package p func f(i int) int { return i } var i = func() int {a := f(i); return a}() // ERROR "initialization loop"
Go
// errchk $G -e $D/$F.dir/[ab].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. // Issue 1284 package bug313 /* 6g bug313.dir/[ab].go Before: bug313.dir/b.go:7: internal compiler error: fault Now: bug...
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 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 s string; s = "0000000000000000000000000000000000000000000000000000000000"[0:7]; _ = s; } /* uetli:~/Source/go1/test...
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
// 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() { var i int var j int if true { } { return } i = 0 if true { } else { i++ } type s struct{} i = 0 type s2 int...
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
// 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
// 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 p1 type T <-chan int var x = make(chan 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 p2 import _ "./p1"
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() { i5 := 5; switch { // compiler crash fixable with 'switch true' case i5 < 5: dummy := 0; _ = dummy; case i5 == 5: dummy...
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 func f(args ...int) { g(args) } func g(args ...interface{}) { f(args) // ERROR "cannot use|incompatible" }
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 const c = 1; func main() { c := 0; _ = c; } /* bug144.go:8: left side of := must be a name bug144.go:8: operation LITERAL not allo...
Go
// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out // 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 case for issue 1550 ignored
Go
// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go && $G $D/$F.dir/three.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
// 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 f0() string { const f = 3.141592; return fmt.Sprintf("%v", float64(f)); } func f1() string { const f = 3.141592; ...
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 v1 = T1(1) var v2 = T2{2} var v3 = T3{0: 3, 1: 4} var v4 = T4{0: 5, 1: 6} var v5 = T5{0: 7, 1: 8} var v6 = T2{f: 9} var v7 = T4{f: 10}...
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 v interface{} = 0; switch v.(type) { case int: fallthrough; // ERROR "fallthrough" default: panic("fell t...
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 1951 package foo import "unsafe" var v = unsafe.Sizeof // ERROR "must be called"
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
// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out || echo BUG: should not fail // 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
// 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() { var u30 uint64 = 0; var u31 uint64 = 1; _, _ = u30, u31; var u32 uint64 = 18446744073709551615; var u33 uint64 = +1844...
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
// 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. package main import "fmt" func main() { // invalid use of goto. // do whatever you like, just don't crash. i := 42 a := []*int{&i, &i, &i,...
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 func f() { var x struct { T }; var y struct { T T }; x = y; // ERROR "cannot|incompatible" _ = x; } type T1 struct...
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 I interface { m() } type T struct { m func() } type M struct {} func (M) m() {} func main() { var t T var m M var i I ...
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 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
// 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 import ( "runtime" "strings" ) var t *struct { c chan int } var c chan int func f() { select { case <-t.c: // THIS IS LINE 22 ...
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 Service struct { rpc [2]int } func (s *Service) Serve(a int64) { if a != 1234 { print(a, " not 1234\n") panic("fail") } } va...
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
// 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 1016 package bug309 func foo(t interface{}, c chan int) { switch v := t.(type) { case int: select { case <-c: // bug was: inter...
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 1709 package main func main() { type Ts string var ts Ts _ = []byte(ts) } /* bug333.go:14: cannot use ts (type Ts) as ...
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 2563 package foo func fn(a float32) {} var f func(arg int) = fn // ERROR "cannot use fn .type func.float32.. as type func.int. in as...
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 be rejected // http://code.google.com/p/go/issues/detail?id=188 package main func complexSqrt(i int) (int, int) { return 0, 1 } var re...
Go
// run // 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 "fmt" var a = []int64{ 0.0005 * 1e9, 0.001 * 1e9, 0.005 * 1e9, 0.01 * 1e9, 0.05 * 1e9, 0.1 * 1e9, 0.5 * 1e9, 1 * 1e9, 5 ...
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. // http://code.google.com/p/go/issues/detail?id=806 // triggered out of registers on 8g package bug283 type Point struct { x int y int } func ...
Go