code
stringlengths
10
1.34M
language
stringclasses
1 value
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug142 // Copyright 2009 The Go Authors. All 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 panic1(s string) bool { panic(s); } func main() { x := false && panic1("first"...
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 shift(x int) int { return 1 << (1 << (1 << (uint(x)))) } func main() { if n := shift(2); n != 1<<(1...
Go
// errchk $G -e $D/$F.go // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { x := "" x = +"hello" // ERROR "invalid operation.*string" x = +x // ERROR "invalid operation.*string...
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 import "testing" func main() { var t testing.T // make sure error mentions that // ch is unexported, not just "ch...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug120 // Copyright 2009 The Go Authors. All 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 "strconv" type Test struct { f float64 in string out string ...
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" type Buffer int func (*Buffer) Read() {} type Reader interface { Read() } func f() *Buff...
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 f9(a int) (i int, f float64) { i := 9 // ERROR "redecl|no new" f := float64(9) // ERROR "redecl|no new" re...
Go
// $G $D/$F.go || echo BUG: bug214 // Copyright 2009 The Go 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(ma...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug321 // 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. // Troublesome floating point constants. Issue 1463. package main import "fmt" func check(test s...
Go
// $G $D/$F.go || echo BUG: bug250 // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main type I1 interface { m() I2 } type I2 interface { I1 } var i1 I1 = i2 var i2 I2 var i2a I2 = i1
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug285 // 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 for issue 778: Map key values that are assignment // compatible with the map key type must ...
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 1011. Removing either #1 or #3 avoided the crash at #2. package main import ( "io" "strings" ) func read...
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 atom(s string) { if s == nil { // ERROR "nil|incompatible" return; } } func main() {} /* bug047.go:4: fatal erro...
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 Box struct {}; var m map[string] *Box; func main() { m := make(map[string] *Box); s := "foo"; var...
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. func main() { // ERROR "package" }
Go
// $G $D/$F.go || echo BUG129 // Copyright 2009 The Go Authors. 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
// $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 t int func main() { t := 0; _ = t; } /* bug145.go:8: t is type, not var */
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. // Used to crash the compiler. // http://code.google.com/p/go/issues/detail?id=158 package main type A struct { a A } // ERROR "recursi...
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. // Test cases for conversion syntax. package main type ( A [3]int S struct { x int } P *S F func(x int) int ...
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. // 6g accepts the program below even though it is syntactically incorrect: // Each statement in the list of statements for each case cla...
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 T struct { x, y int } func (t *T) m(a int, b float64) int { return (t.x + a) * (t.y + int(b)) } ...
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 t []int var s string; var m map[string]int; func main() { println(t["hi"]); // ERROR "integer" println(s["hi"]); // ...
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 P(a []string) string { s := "{"; for i := 0; i < 2; i++ { if i > 0 { 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 func main() { var c00 uint8 = '\0'; // ERROR "oct|char" var c01 uint8 = '\07'; // ERROR "oct|char" var cx0 uint8 = '\x...
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 f() {} func main() { x := 0; // this compiles switch x { case 0: f(); default: f(); } /...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug341 // 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 u...
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() { fired := false; _ = fired; } /* bug9.go:5: defaultlit: unknown literal: LITERAL-B0 a(1) 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 func main() { // should allow at most 2 sizes a := make([]int, 10, 20, 30, 40); // ERROR "too many" }
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 T // ERROR "recursive"
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 ( Point struct { x, y float64 } Polar Point ) func main() { } /* bug7.go:5: addtyp: renaming P...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug246 // Copyright 2009 The Go Authors. All 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() { // works addr := uintptr(0x234) x1 := (*int)(unsafe....
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. // 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-in...
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 T) T { return a } // ERROR "undefined" func main() { x := f(0); _ = x; }
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug317 // 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...
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 . "testing" // defines top-level T type S struct { T int } func main() { _ = &S{T: 1} // shou...
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. // Issue 1606. package main func main() { var x interface{} switch t := x.(type) { // ERROR "0 is not a type" case 0: t.x = 1 // ...
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. // Issue 1722. // Check that the error messages says // bug337.go:16: len("foo") not used // and not // bug337.go:16: 3 not used pack...
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 Send(c chan int) int { select { default: return 1; } return 2; }
Go
// $G $D/$F.go || echo BUG: compiler crashes // Copyright 2009 The Go Authors. All 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 rat struct { den int; } func (u *rat) pr() { } type dch struct { dat chan *rat; } 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 func main() { s := 0; for _, v := range []int{1} { s += v; } if s != 1 { println("BUG: s =", s); ...
Go
// $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 int a := uint64(uintptr(unsafe.Pointer(&x))) b := uint32(uintptr(unsafe.Pointer(&x))) ...
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 A []int; type M map[int] int; func main() { var a *A = &A{0}; var m *M = &M{0 : 0}; // should ...
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 P const a = 0; func f(a int) { a = 0; } /* bug161.go:8: operation LITERAL not allowed in assignment cont...
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 main type T struct { x, y *T } func main() { // legal composite literals _ = struct{}{} _ = [42]int{} _ = [...]int{} _ =...
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() { s1 := "hi"; s2 := "ho"; s1 += s2; }
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. // used to crash the compiler package main type T struct { x [4]byte } var p *T var v = *p
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 { return 0; } func main() { const n = f(); // ERROR "const" }
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 var digits string; func putint(buf []byte, i, base, val int, digits string) { buf[i] = digits[val]; ...
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
// $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=662 package main import "fmt" func f() (int, int) { return 1, 2 } f...
Go
// $G $D/$F.go && $L $F.$A && ! ./$A.out || echo BUG: should crash // Copyright 2009 The Go Authors. All 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 f(x interface{}) interface{} { type T struct ...
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 i, k int; outer: for k=0; k<2; k++ { print("outer loop top k ", k, "\n"); if k !=...
Go
// $G $D/$F.go || echo BUG: bug174 // Copyright 2009 The Go Authors. All 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
// $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 "fmt" var x = uint32(0x01020304) var y = [...]uint32{1,2,3,4,5} func main() { fmt.Sprint(y[byte...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug159 // Copyright 2009 The Go Authors. All 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 { ...
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() { s := string(bug); // ERROR "undef" }
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 import . "unsafe" // ERROR "not used" func main() { var x int println(unsafe.Sizeof(x)) // ERROR "undefined" } /* Af...
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 i int; i = '\''; i = '\\'; var s string; s = "\""; _, _ = i, s; } /* bug.go:5: unk...
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 T struct { m map[int]int } func main() { t := new(T); t.m = make(map[int]int); var x int; var ok ...
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() { switch ; { case false: return; } // compiles; should be an error (should be simplevardecl ...
Go
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) } type t0 int func (t0) M(p0.T) {} type t1 float64 func (t1) M(p1.T) {} var i0 I0 = t0(0) // ok var i1 I1 = t1(0) // ok var p0i p0.I = t0(0) // ok var p1...
Go
package p type T struct { X, Y int } type I interface { M(T) }
Go
package p type T struct { X, Y int } type I interface { M(T) }
Go
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 type I0 interface { M(p0.T) } type I1 interface { M(p1.T) } // t0 satisfies I0 and p0.I type t0 int func (t0) M(p0.T) {} // t1 satisfies I1 and p1.I type t1...
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 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...
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 c = 3 var x = c.String() // ERROR "String"
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 f(a float64) float64 { e := 1.0 e = e * a return e } /* 6g bugs/bug109.go bugs/bug109.go:5: 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 type A []int; func main() { a := &A{0}; b := &A{0, 1}; _, _ = a, b; } /* uetli:~/Source/go1/test/b...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug253 // 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 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
// $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 import "unsafe" func main() { var p unsafe.Pointer println(p) }
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() { s := uint(10) ss := 1 << s y1 := float64(ss) y2 := float64(1 << s) // ERROR "shift" y3 := string(1 << s)...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug196 // Copyright 2009 The Go Authors. All 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...
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
// 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 // type T int func main() {} // issue 1474 // important: no newline on end of next line. // 6g used to print <epoch> in...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG code should 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()...
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() { s := float(0); s := float(0); // BUG redeclaration }
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 main type T struct { // legal according to spec x int y (int) int *float64 // not legal according to spec (complex128) ...
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
// $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 ( nf int x, y, z = f(), f(), f() m = map[string]string{"a": "A"} a, aok = m["a"] b, ...
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() { // 6g used to compile these as two different // hash codes so it missed the duplication // and worse, comp...
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
// $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 T struct { s string } var t = T{"hi"} func main() {} /* bug112.go:6: illegal conversion of const...
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 s string; s = "0000000000000000000000000000000000000000000000000000000000"[0:7]; _ = ...
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() { const a uint64 = 10; var b int64 = a; // ERROR "convert|cannot|incompatible" }
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 i int var j int if true { } { return } i = 0 if true { } else { i++ } typ...
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
// $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 "math" func f() float64 { math.Pow(2, 2) return 1 } func main() { for i := 0; i < 10; 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() { switch ; { case true: return; default: return } } /* bug003.go:6: fatal error: walkswitch: ...
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
// ! $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() { var z [3]byte; z := new([3]byte); // BUG redeclaration }
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() { i5 := 5; switch { // compiler crash fixable with 'switch true' case i5 < 5: dummy := 0;...
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 main func f(args ...int) { g(args) } func g(args ...interface{}) { f(args) // ERROR "cannot use|incompatible" }
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 const c = 1; func main() { c := 0; _ = c; } /* bug144.go:8: left side of := must be a name bug144.g...
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