code
stringlengths
10
1.34M
language
stringclasses
1 value
// 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 pkg2 import "./one" func use() { one.F1(nil) one.F2(nil) one.F3() ...
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 pkg2.go so that the inlined // forms get type-checked. package pkg3 import "./pkg2" var x = pkg2.F() var v = pkg2.V
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
// compiledir // 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 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 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 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 type T x.T // ERROR "undefined" // bogus "invalid recursive type"
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
// 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. // Issue 3835: 8g tries to optimize arithmetic involving integer // constants, but can run out of registers in the process. package main var a, b, c,...
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
// 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 2497 package main type Header struct{} func (h Header) Method() {} var _ interface{} = Header{} func main() { type X Header var _ in...
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() { x := 0; if x { // ERROR "x.*int|bool" } }
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. // Issue 2821 package main type matrix struct { e []int } func (a matrix) equal() bool { for _ = range a.e { } return true } func main() { var ...
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 { // ERROR "return|control" if false { return 0; } // we should not be able to return successfully w/o a return s...
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 // Interface type I interface { F() int } // Implements interface type S struct { } func (s *S) F() int { return 1 } // Allocates S but ...
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=700 package main import "os" func f() (e int) { _ = &e return 999 } func main() { i...
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 b func init() { println("b"); } type V int;
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 a func init() { println("a"); } type T int;
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
// 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
// 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
// $G $D/$F.dir/bug0.go && // $G $D/$F.dir/bug1.go && // $G $D/$F.dir/bug2.go && // errchk $G -e $D/$F.dir/bug3.go && // $L bug2.$A && // ./$A.out || echo BUG: failed to 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 ...
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 1011. Removing either #1 or #3 avoided the crash at #2. package main import ( "io" "strings" ) func readU16BE(b []byte) uint16 { b[0] =...
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 1192 - detail in error package main func foo() (a, b, c int) { return 0, 1 2.01 // ERROR "unexpected literal 2.01|expected ';' or '...
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=3119 package main import "fmt" func main() { s := "hello" fmt.Println(s == "") fmt.Println(s +...
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
// 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 Box struct {}; var m map[string] *Box; func main() { m := make(map[string] *Box); s := "foo"; var x *Box = nil; m[s] = x; } /* ...
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 g byte = 123 var f *byte = &g var b = make([]byte, 5) func main() { b[0:1][0] = *f if b[0] != 123 { println("want 123 got", b[0])...
Go
// $G $D/bug302.dir/p.go && pack grc pp.a p.$A && $G $D/bug302.dir/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.
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
// 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() string { return 0 // ERROR "conversion|type" }
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; } func main() { s := ""; l1 := len(s); var t T; l2 := len(t.s); // BUG: cannot take len() of a string...
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 R interface { duplicate() } type S interface { duplicate() } type T interface { R; S } // ERROR "duplicate" func main() { }
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(map[I] bool); // ok } type S struct { m map[S] bool; // ERROR "map key type" }
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
// 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() { prog := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ "xxxxxxxxxx"+ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ ...
Go
// runoutput // 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 3866 // runtime.equal failed to take padding between arguments and // return values into account, so in certain cases gc-generated // cod...
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. // Caused a gccgo crash on compilation. // bug304.go: In function ‘p.f’: // bug304.go:15:2: internal compiler error: in copy_tree_r, at tree-inline...
Go
// compiledir // 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 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 ( F = 1 ) func fn(i int) int { if i == F() { // ERROR "func" return 0 } return 1 }
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 3765 package main func f(x uint) uint { m := ^(1 << x) return uint(m) }
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 string type I int type F float64 func (S) m() {} func (I) m() {} func (F) m() {} func main() { c := make(chan interface { m()...
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. // Used to die dividing by zero; issue 879. package main var mult [3][...]byte = [3][5]byte{} // ERROR "\.\.\."
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 Type interface { TypeName() string; } type TInt struct { } // TInt func (i *TInt) TypeName() string { return "int"; } func main...
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
// 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=800 package main var log string type T int func (t T) a(s string) T { log += "a(" + s + ")" retur...
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() { c := make(chan int); ok := false; var i int; i, ok = <-c; // works _, _ = i, ok; ca := new([2]chan int); i, ...
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 main type T []int func (t T) m() func main() { _ = T{} } // bug245.go:14: fatal error: method mismatch: T for 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 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
// 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. // Used to panic because 8g was generating incorrect // code for converting a negative float to a uint64. package main func main() { var x float32 =...
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