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 import "io" func f() (_ string, x float64, err error) { return } func g() (_ string, x float64, err error) { return "hello", 3.14, io...
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 ddd func Sum() int for i := range []int{} { return i } // ERROR "statement outside function|expected"
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
// 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
// $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
// 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
// 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
// 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 s string = nil; // ERROR "illegal|invalid|incompatible|cannot" }
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
// 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
// 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
// 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 "testing" func main() { var t testing.T // make sure error mentions that // name is unexported, not just "name not fo...
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 T1 struct { x, y int } type T2 struct { z, w byte } type T3 T1 type MyInt int func (MyInt) m(*T1) {} func main() { { var i in...
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 T struct{ *p.S } type I interface { get() } func main() { var t T p.F(t) var x interface{} = t _, ok := x.(I) if ok ...
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 T struct{ x int } type S struct{} func (p *S) get() { } type I interface { get() } func F(i I) { i.get() }
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 func main() { type T struct { s string f float64 } var s string = "hello" var f float64 = 0.2 t := T{s, f} type M map[int]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 type T func() type I interface { f, g (); // ERROR "name list not allowed" } type J interface { h T; // ERROR "syntax|signatur...
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
// 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 var f = func() int { type S int return 42 } func main() { if f() != 42 { panic("BUG: bug355") } }
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 int func main() { t := 0; _ = t; } /* bug145.go:8: t is type, not 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 var t []int var s string; var m map[string]int; func main() { println(t["hi"]); // ERROR "integer" println(s["hi"]); // ERROR "i...
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 1608. // Size used to be -1000000000. package main import "unsafe" func main() { var a interface{} = 0 size := unsafe.Sizeof(a) if size ...
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 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 crashed compiling this file. package p var V = "a" > "b"
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
// 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
// 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
// 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
// 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
// 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
// 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
// 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 var x [10][0]byte var y = make([]struct{}, 10) func main() { if &x[1] != &x[2] { println("BUG: bug352 [0]byte") } if &y[1] != &y[2]...
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" const ( x float64 = iota g float64 = 4.5 * iota ) func main() { if g == 0.0 { print("zero\n") } if g != 4.5 { print...
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 g() {} func f1() (a, b int) { a, b = 2, 1 g() // defeat optimizer return a, b } func f2() (a, b int) { a, b = 1, 2 g() // defe...
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 x const Zero = 0.0 const Ten = 10.0
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 main import "os" import "./x" func main() { if x.Zero != 0 { println("x.Zero = ", x.Zero); os.Exit(1); } if x.Ten != 10 { println("x.Ten = "...
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 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
// 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 2582 package main type T struct{} func (T) cplx() complex128 { for false { } // avoid inlining return complex(1, 0) } func (T) cplx2() 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. package main type T struct { // legal according to spec x int y (int) int *float64 // not legal according to spec (complex128) // ERROR...
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
// 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
// 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 bug150 type T int func (t T) M() type M interface { M() } func g() (T, T) func f() (a, b M) { a, b = g(); return; } /* bugs/bug150.g...
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
// 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 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 1662 // iota inside var package main var ( a = iota // ERROR "undefined: iota|iota is only defined in const" b = iota // ERROR "u...
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 1927. // gccgo failed to issue the first error below. package main func main() { println(int(1) == uint(1)) // ERROR "types" var x i...
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. // Test that typed and untyped negative zero floating point constants // are treated as equivalent to zero constants. package main import "math" cons...
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() { 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 func foo(a []int) int { return a[0] // this seems to do the wrong thing } func main() { a := &[]int{12} if x := (*a)[0]; x != 12 { 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 type Type interface { TypeName() string; } type TInt struct { } // TInt func (i *TInt) TypeName() string { return "int"; } 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 T *struct { T; // ERROR "embed.*pointer" }
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() { k, l, m := 0,0,0; _, _, _ = k, l, 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 import "os" func P(a []string) string { s := "{"; for i := 0; i < 2; i++ { if i > 0 { s += "," } s += `"` + a[i] + `"`; } 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 p1 type T struct { f func() "x" }
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
// 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 2598 package foo return nil // ERROR "non-declaration statement outside function body|expected declaration"
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
// 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
// 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
// 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 var c1 chan <- chan int = (chan<- (chan int))(nil) var c2 chan <- chan int = (chan (<-chan int))(nil) // ERROR "chan|incompatible...
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. // Test that a syntax error caused by an unexpected EOF // gives an error message with the correct line number. // // https://code.google.com/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 var x int var a = []int{ x: 1} // ERROR "constant" var b = [...]int{ x : 1} // ERROR "constant" var c = map[int]int{ x: 1}
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 // same const identifier declared twice should not be accepted const none = 0 // GCCGO_ERROR "previous" const none = 1; // ERROR ...
Go
// $G $D/$F.dir/lib.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out || echo BUG: fails incorrectly // 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 1402. 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 1871. package p type a interface { foo(x int) (x int) // ERROR "redeclared|redefinition" } var b interface { bar(y int) (y int) //...
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 2588. Used to trigger internal compiler error on 8g, // because the compiler tried to registerize the int64 being // used as a memory ope...
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() { // should allow at most 2 sizes a := make([]int, 10, 20, 30, 40); // ERROR "too many" }
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. // Test using _ receiver. Failed with gccgo. package main type S struct {} func (_ S) F(i int) int { return i } func main() { s := S{} const 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. // Test cases for revised conversion rules. package main func main() { type NewInt int i0 := 0 var i1 int = 1 var i2 NewInt = 1 i0 = i0 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() { i5 := 5; switch { // compiler crash fixable with 'switch true' case i5 < 5: dummy := 0; _ = dummy; case i5 == 5: dummy...
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 := 0; // this compiles switch x { case 0: } // this doesn't but should switch 0 { case 0: } } /* bug158.g...
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 dosplit(wait chan int ){ select { case <-wait: } } 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 two import _ "./one"
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 one func Foo() (n int64, _ *int) { return 42, nil }
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
// 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 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
// 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() { v := 1 << 1025; // ERROR "overflow|stupid shift" _ = v }
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. // Valid program, gccgo reported an error. // bug307.go:14:6: error: complex arguments must have identical types package main func main() { var 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 { 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
// 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 T // ERROR "recursive"
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. // RESOLUTION: This program is illegal. We should reject all unnecessary backslashes. package main const c = '\''; // this works const 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 f(i int, f float64) { i = 8 f = 8.0 return } func main() { f(3, float64(5)) } /* bug10.go:5: i undefined bug10.go:6: illegal c...
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 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
// 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 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 2576 package bug type T struct { a int } func f(t T) { switch _, _ = t.a, t.a; {} }
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
// 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 var n int func f() int { n++ return n } func main() { x := []int{0,1,2,3,4,5,6,7,8,9,10} n = 5 y := x[f():f()] if len(y) != 1 || ...
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 1368. package main func main() { a := complex(2, 2) a /= 2 } /* bug315.go:13: internal compiler error: optoas: no entry DIV-complex */...
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
// 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() { c := make(chan bool, 1); select { case _ = <-c: panic("BUG: recv should not"); default: } c <- true; select { cas...
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
// 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 type T struct { i int }
Go