code
stringlengths
10
1.34M
language
stringclasses
1 value
// 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 R interface { duplicate() } type S interface { duplicate() } type T interface { R; S } // ERROR "duplicate" 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 import "reflect" type S1 struct { i int } type S2 struct { S1 } func main() { typ := reflect.Typeof(S2{})....
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() { k, l, m := 0,0,0; _, _, _ = k, l, m; }
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
// 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 P var x int func foo() { print(P.x); // ERROR "undefined" } /* uetli:~/Source/go1/test/bugs gri$ 6g bug085.go bug085.go:6: P...
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 var V0 func() int; var V1 func() (a int); var V2 func() (a, b 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 main import P "./bug0" func main() { a0 := P.V0(); // works a1 := P.V1(); // works a2, b2 := P.V2(); // doesn't work _, _, _, _ = a0, a1, a2, ...
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 I int type S struct { f map[I]int } var v1 = S{ make(map[int]int) } // ERROR "cannot|illegal|incompatible|wrong" var v...
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 struct { a []int; } var s = &S{make([]int, 10)} func main() { s.a[f()] = 1 // 6g used to call f ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: should not 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 func main() { var b [0]byte; s := string(&b); // out of bounds trap if 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 s string = nil; // ERROR "illegal|invalid|incompatible|cannot" }
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, bool) { return 0, true } func main() { x, y := f(), 2; // ERROR "multi" }
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 ( c3div2 = 3/2; f3div2 = 3./2.; ) func assert(t bool, s string) { if !t { panic(s) } } func main() { var i i...
Go
// $G $D/$F.go && $L $F.$A || echo BUG: bug167 // Copyright 2009 The Go Authors. All 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 f1() { type T struct { x int } } func f2() { type T struct { x float } } func main() { f...
Go
// $G $D/bug160.dir/x.go && $G $D/bug160.dir/y.go && $L y.$A x.$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. nothing to see here
Go
// $G $D/$F.go && $L $F.$A && (./$A.out || echo BUG: bug114 failed) // Copyright 2009 The Go Authors. All 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 m...
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() { Foo: { return; } goto Foo; } /* bug5.go:4: Foo undefined bug5.go:4: fatal error: walkty...
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 int; x := 0; // ERROR "declar|:=" _ = x; }
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 := vlong(0); // ERROR "undef" }
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 {} func (x T) M () {} // ERROR "pointer|receiver" /* bug046.go:7: illegal <this> 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 x int var a = []int{ x: 1} // ERROR "constant" var b = [...]int{ x : 1} // ERROR "constant" var c = map[int]int{ x: 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 S struct { a, b int } func main() { s1 := S{a: 7}; // ok - field is named s3 := S{7, 11}; // ok - all fields have ...
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 type U int var x int var t T = int(0) // ERROR "cannot use|incompatible" var t1 T = int(x) // ERROR "cannot us...
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 S struct { a int } type PS *S func (p *S) get() int { return p.a } func fn(p PS) int { // p has type PS, and PS has ...
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 := 0; if x { // ERROR "x.*int|bool" } }
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 func main(){ c := make(chan int); ok := false; var i int; i, ok = <-c; // works _, _ = i, ok; ca := new([2]chan int); 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() { prog := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+ "xxxxxxxxxx"+ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
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 cu0 uint16 = '\u1234'; var cU1 uint32 = '\U00101234'; _, _ = cu0, cU1; } /* bug13.go:...
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 buf [10]int; for ; len(buf); { // ERROR "bool" } } /* uetli:/home/gri/go/test/bugs gri$ 6g bug209.go...
Go
// $G $D/$F.go || echo BUG: bug151 // Copyright 2009 The Go Authors. All 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 Empty interface {} func (v S) Less(e Empty) bool { return v < e.(S); } /* bugs/bug151.g...
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() { if {} else L1: ; if {} else L2: main() ; } /* These should be legal according to the 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() { if {} // compiles; should be an error (must be an expression) }
Go
// $G $D/$F.go && $L $F.$A && (! ./$A.out || echo BUG: should not 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 type I interface { }; func foo1(i int) int { return i } func foo2(i 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 import os "os" type _ os.Error func f() (os int) { // In the next line "os" should refer to the result variable, not // ...
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 ( F = 1 ) func fn(i int) int { if i == F() { // ERROR "func" return 0 } return 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 func f() int { } // ERROR "return|control" func g() (foo int) { } // ERROR "return|control"
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() string { return 0 // ERROR "conversion|type" }
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 main() { L: for { for { break L2; // ERROR "L2" continue L2; // ERROR "L2" } } L1: x := 1; _ = x; f...
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 f1() { exit: print("hi\n"); } func f2() { const c = 1234; } func f3() { i := c; // ERROR "undef" } func main()...
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 I1 interface { I2 } // ERROR "interface" type I2 int type I3 interface { int } // ERROR "interface" type S 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 f(i int, f float) { i = 8; f = 8.0; return; } func main() { f(3, float(5)) } /* bug10.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 Foo interface { } type T struct {} func (t *T) foo() {} func main() { t := new(T); var i inte...
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 ncall int; type Iffy interface { Me() Iffy } type Stucky struct ...
Go
// $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<<(1...
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() *Buffe...
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 float) { i := 9; // ERROR "redecl|no new" f := float(9); // ERROR "redecl|no new" return i, f...
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
// $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 float) int { return (t.x+a) * (t.y+int(b)); } 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 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 // Copyright 2009 The Go Authors. All 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
// $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 float }; Polar Point ) func main() { } /* bug7.go:5: addtyp: renaming Point...
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 || 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 || 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
// $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
// 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
// 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 ( OS "os" // should require semicolon here; this is no different from other decls IO "io" // ERROR "missing|synt...
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
// 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 "os" func fn() { var e os.Error if e == nil { // ERROR "syntax error|expected ';'" } }
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
// $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
// $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 float) float { e := 1.0; e = e * a; return e; } /* 6g bugs/bug109.go bugs/bug109.go:5: ill...
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
// 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 := float(ss); y2 := float(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) { ret...
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 2009 The Go Authors. All 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 ...) { } func main() { f(nil); // ERROR "nil" }
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
// $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++; type s struct...
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 2009 The Go Authors. All 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
// ! $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
// $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.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, 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 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