code
stringlengths
10
1.34M
language
stringclasses
1 value
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: should not panic // 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("%...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG should compile and 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,...
Go
// errchk $G $D/$F.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 func main() { var v interface{} = 0; switch x := v.(type) { case int: fallthrough; // ERROR "fallthrough" default: ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG wrong result // 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} ...
Go
// $G $D/$F.go && $L $F.$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. package main func main() { var u30 uint64 = 0; var u31 uint64 = 1; _, _ = u30, u31; var u32 uint64 = 1844674407370...
Go
// errchk $G $D/$F.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 func f (x int) { // GCCGO_ERROR "previous" var x int; // ERROR "redecl|redefinition" }
Go
// (! $G $D/$F.go) | grep 'initialization loop' >/dev/null || echo BUG: bug223 // 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 use...
Go
//errchk $G $D/$F.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 type T int func f() { var x struct { T }; var y struct { T T }; x = y; // ERROR "cannot|incompatible" _ = x; } type T1...
Go
// errchk $G -e $D/$F.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 type I interface { m() } type T struct { m func() } type M struct {} func (M) m() {} func main() { var t T var m M ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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: ...
Go
// $G $D/$F.go && $L $F.$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. package main type Service struct { rpc [2]int } func (s *Service) Serve(a int64) { if a != 1234 { print(a, " not 1...
Go
// $G $D/$F.go || echo BUG: should 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)...
Go
// $G $D/$F.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 1016 package main func foo(t interface{}, c chan int) { switch v := t.(type) { case int: select { case <-c: // bug was: int...
Go
// $G $D/$F.go && $L $F.$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. // Issue 1709 package main func main() { type Ts string var ts Ts _ = []byte(ts) } /* bug333.go...
Go
// $G $D/$F.go || echo BUG: bug216 // 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)...
Go
// $G $D/$F.go || echo BUG: should 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 main type Point s...
Go
// $G $D/$F.go && $L $F.$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. // used to panic because 6g didn't generate // the code to fill in the ... argument to fmt.Sprint. package main import...
Go
// errchk $G $D/$F.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 func f() int { // ERROR "return|control" if false { return 0; } // we should not be able to return successfully w/o a ...
Go
// $G $D/$F.go && $L $F.$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. package main func main() { nchar := 0; a := []int { '日', '本', '語', 0xFFFD }; for _, char := range "日本語\xc0" { if n...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG // 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 in...
Go
// $G $D/$F.go && $L $F.$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. // Issue 1608. // Size used to be -1000000000. package main import "unsafe" func main() { var a interface{} = 0 si...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug147 // 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 "time" func main() { var count int c := make(chan byte) go func(c chan byte...
Go
// errchk $G $D/$F.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 var v1 = ([10]int)(nil); // ERROR "illegal|nil|invalid" var v2 [10]int = nil; // ERROR "illegal|nil|incompatible" var v3 [1...
Go
// errchk $G $D/$F.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 type T struct { x, x int // ERROR "duplicate" }
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 bug2 import _ "./bug1" import "./bug0" type T2 struct { t bug0.T } func fn(p *T2) int { // This reference should be invalid, because bug0.T.i is lo...
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
// 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" type T struct { t bug0.T }
Go
// $G $D/$F.go && $L $F.$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. package main type S string type I int type F float64 func (S) m() {} func (I) m() {} func (F) m() {} func main() { ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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=745 package main type T1 struct { T2 *T2 } type T2 struct { T3 *T3...
Go
// $G $D/$F.go || echo BUG: bug315 // 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:...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug247 // 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() { const ( Delta = 100 * 1e6 Count = 10 ) _ = int64(Delta * Count) ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 ( "os" "strconv" ) var trace string func f() string { trace += "f" return "abc" } func g() *...
Go
// $G $D/$F.go || echo BUG: bug220 // 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() { m := make(map[int]map[uint]float64) m[0] = make(map[uint]float64), false // 6g used to rejec...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug116 // 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() { bad := false if (-5 >> 1) != -3 { println("-5>>1 =", -5>>1, "want -3...
Go
// $G $D/$F.go || echo BUG: bug245 // 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
// errchk $G $D/$F.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 type T func() type I interface { f, g (); // ERROR "name list not allowed" } type J interface { h T; // ERROR "syntax|...
Go
// $G $D/$F.go || echo BUG: bug173 // 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. // these used to fail because the runtime // functions that get called to implement them // expected string, not T. package...
Go
// $G $D/$F.go && $L $F.$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. package main import "fmt" var indent uint = 10 func main() { const dots = ". . . . . . . . . . . . . . . . . . . . ....
Go
// errchk $G $D/$F.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 // same const identifier declared twice should not be accepted const none = 0 // GCCGO_ERROR "previous" const none = 1; /...
Go
// ! $G $D/$F.go >/dev/null // # ignoring error messages... // 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, x int) { // BUG redeclaration error }
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug343 // 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]s...
Go
// errchk $G $D/$F.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 const X = iota func f(x int) { } func main() { f(X); f(iota); // ERROR "iota" f(X); }
Go
// errchk $G -e $D/$F.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 func f(x int, y ...int) // ok func g(x int, y float) (...) // ERROR "[.][.][.]" func h(x, y ...int) // ERROR "[.][.]...
Go
// $G $D/$F.go && $L $F.$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. // function call arg reordering was picking out 1 call that // didn't need to be in a temporary, but it was picking // o...
Go
// $G $D/$F.go && $L $F.$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. package main func main() { if ; false {} // compiles; should be an error (should be simplevardecl before ;) }
Go
// errchk $G $D/$F.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 func f() { a := true; a |= a; // ERROR "illegal.*OR|bool|expected" }
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 t0 struct { } var V0 t0
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" // This is expected to fail--t0 is in package bug0 and should not be // visible here in package bug1. The test for failure is i...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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=799 package main import "unsafe" func main() { n := unsafe.Sizeof(0...
Go
// errchk $G $D/$F.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 func putint(digits *string) { var i byte; i = (*digits)[7]; // compiles i = digits[7]; // ERROR "illegal|is not|invali...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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 nf int var ng int func f() (int, int, int) { nf++ return 1, 2, 3 } func g() int { ng++ return 4 ...
Go
// $G $D/$F.go && $L $F.$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. package main type Element interface { } type Vector struct { nelem int; elem []Element; } func New() *Vector { v :...
Go
// $G $D/$F.go && $L $F.$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. package main func main() { c := make(chan int, 1) dummy := make(chan int) v := 0x12345678 for i := 0; i < 10; i++ ...
Go
// $G $D/$F.go || echo BUG: should 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...
Go
// $G $D/$F.go && $L $F.$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. package main import "os" func main() { m := make(map[int]int); m[0] = 0; m[0]++; if m[0] != 1 { print("map does ...
Go
// $G $D/$F.go || echo BUG: bug301.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. // http://code.google.com/p/go/issues/detail?id=990 package main func main() { defer func() { if recover() != nil {...
Go
// $G $D/$F.go || echo BUG should 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() { L1: L2: for i := 0; i < 10; i++ { print(i) break L2 } L3: ; L4: for i := 0; i < ...
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
// $G $D/$F.go || echo BUG: should 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 exit int exit: _ = exit goto exit }
Go
// $G $D/$F.go && $L $F.$A && ./$A.out // 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=843 package main import "unsafe" type T struct { X, Y uint8 } func...
Go
// $G $D/$F.go && $L $F.$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. package main import "os" const ( x float64 = iota g float64 = 4.5 * iota ) func main() { if g == 0.0 { print("ze...
Go
// errchk $G $D/$F.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 ddd func Sum() int for i := range []int{} { return i } // ERROR "return outside function|expected"
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: should 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" type I interface { send(chan <- int) } type S struct { v int } func ...
Go
// errchk $G $D/$F.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 func main() { var x int64 = 0; println(x != nil); // ERROR "illegal|incompatible|nil" println(0 != nil); // ERROR "illega...
Go
// errchk $G $D/$F.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 func main() { L: ; // ';' terminates empty statement => L does not apply to for loop for i := 0; i < 10; i++ { println...
Go
// $G $D/$F.dir/x.go && errchk $G $D/$F.dir/y.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/$F.go || echo BUG should 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 fun...
Go
// errchk $G $D/$F.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 const x x = 2 // ERROR "loop|type" /* bug081.go:3: first constant must evaluate an expression Bus error */
Go
// errchk $G $D/$F.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 func main() { var i33 int64; if i33 == (1<<64) -1 { // ERROR "overflow" } }
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
// errchk $G $D/$F.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 "sort" func main() { sort.Sort(nil); var x int; sort(x); // ERROR "package" }
Go
// $G $D/$F.go || echo BUG: bug334 // 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 1716 package main type ( cplx64 complex64 cplx128 complex128 ) func (c cplx64) Foo() {} func (c cplx128) Fo...
Go
// $G $D/$F.go && $L $F.$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. // Conversion between identical interfaces. // Issue 1647. // The compiler used to not realize this was a no-op, // so...
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 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
// $G $D/$F.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 1136 package main import "fmt" func log1(f string, argv ...interface{}) { fmt.Printf("log: %s\n", fmt.Sprintf(f, argv...)) } func...
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
// $G $D/$F.go || echo BUG: compilation should succeed // 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 = s...
Go
// $G $D/$F.go && $L $F.$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. package main func main() { var x int; switch x { case 0: {} case 1: x = 0; } } /* bug0.go:8: case statement ou...
Go
// $G $D/$F.go && $L $F.$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. package main var gen = 'a' func f(n int) string { s := string(gen) + string(n+'A'-1) gen++ return s } func g(x, y...
Go
// $G $D/$F.go || echo BUG should 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 myMap map[string] int; func f() myMap { m := make(map[string] int); return m } func main() { ...
Go
// $G $D/$F.go && $L $F.$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. package main func main() { c := make(chan int, 1) c <- 100 x, ok := <-c if x != 100 || !ok { println("x=", x, " ...
Go
// $G $D/$F.dir/bug0.go && $G $D/$F.dir/bug1.go || 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 the LICENSE file. ignored
Go
// $G $D/$F.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 type Scope struct { entries map[string] *Object; } type Type struct { scope *Scope; } type Object struct { typ *Type; } f...
Go
// $G $D/$F.go || echo BUG // 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 var a []bool func _() { if a[T{42}[0]] { } // if (a[T{42}[0]]) {} // this compiles } /* 6g bugs/bu...
Go
// errchk $G $D/$F.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 type T *struct { T; // ERROR "embed.*pointer" }
Go
// errchk $G $D/$F.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 var c1 chan <- chan int = (chan<- (chan int))(nil) var c2 chan <- chan int = (chan (<-chan int))(nil) // ERROR "chan|inco...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug168 // 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] = ...
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
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug266 // 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 { re...
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
// errchk $G $D/$F.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. // Used to die dividing by zero; issue 879. package main var mult [3][...]byte = [3][5]byte{} // ERROR "\.\.\."
Go
// $G $D/$F.go && $L $F.$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. package main func main() { var a [1000] int64; // this alone works var b [10000] int64; // this causes a runtime cr...
Go
// errchk $G $D/$F.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 func main() { x := string{'a', 'b', '\n'}; // ERROR "composite" print(x); }
Go
// errchk $G $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. package main import "unsafe" func main() { var x unsafe.Pointer println(*x) // ERROR "invalid indirect.*unsafe.Pointer" var _ = (un...
Go
// $G $D/$F.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. package main func f0() { const x = 0; } func f1() { x := 0; _ = x; } func main() { f0(); f1(); } /* ue...
Go