code
stringlengths
10
1.34M
language
stringclasses
1 value
// $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 S struct { i int } func (p *S) Get() int { return p.i } type Em...
Go
// $G $D/$F.go || echo BUG: bug156 // Copyright 2009 The Go Authors. All 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 int64) int64 { const b int64 = 0; n := a &^ b; return n; } func main() { f(1) } /* bug156.go:7:...
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 g() {} func f1() (a, b int) { a, b = 2, 1 g() // defeat optimizer return a, b } func f2() (a, b ...
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. // This is a test case for issue 804. package main func f() [10]int { return [10]int{} } var m map[int][10]int func main() { f()[1...
Go
// $G $D/$F.go || echo BUG: bug150 // Copyright 2009 The Go Authors. All 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() type M interface { M() } func g() (T, T) func f() (a, b M) { a, b = g(); retu...
Go
// $G $D/$F.go || echo BUG: bug239 // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test case for issue 475. This file should compile. package main import . "unsafe" func main() { var x int println(Si...
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 func f() { exit: ; goto exit } func main() { exit: ; // this should be legal (labels not properly scoped?) goto ...
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() { L: for i := 0; i < 1; i++ { L1: for { break L } panic("BUG: not reached - break")...
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. // RESOLUTION: This program is illegal. We should reject all unnecessary backslashes. package main const c = '\''; // this works cons...
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 p import "os" func f() (_ int, err os.Error) { return } func g() (x int, _ os.Error) { return } func h() (_ int, _ os.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 func frexp() (a int, b float64) { return 1, 2.0 } func main() { a, b := frexp(); _, _ = a, b; } /* bu...
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 func f() { v := [...]string{"a", "b"}; _ = v; } func main() { 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 bug0 const A = -1
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"
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 S struct { p *S; s []S; m map[int] S; c chan S; i interface { f(S); }; f func(S) S; } func...
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 f1() (x int, y float64) { return } func f2(x int, y float64) { return } func main() { f2(...
Go
// $G $D/$F.dir/bug0.go && $G $D/$F.dir/bug1.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. ignored
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 s [8]string func init() { s = [...]string{ "now", "is", "the", "time", "to", "fix", "this", "...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: should not fail // Copyright 2009 The Go Authors. All 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 } f...
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. // Valid program, gccgo reported an error. // bug307.go:14:6: error: complex arguments must have identical types package main func main() { v...
Go
// $G $D/$F.go || echo BUG: bug316 // 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 1369. package main const ( c = complex(1, 2) r = real(c) // was: const initializer must be constant i = imag(c...
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 // Interface type I interface { F() int } // Implements interface type S str...
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() /* no return type */ {} func main() { x := f(); // ERROR "mismatch|as value|no type" }
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. // Issue 1787. package main import "unsafe" const x = unsafe.Sizeof([8]byte{}) func main() { var b [x]int _ = b } /* bug338.go:14: array...
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 := 10; d := 7; var x [10]int; i := 0; /* this works: q := c/d; x[i] = q; */ // th...
Go
// errchk $G -e $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. // Test cases for revised conversion rules. package main func main() { type NewInt int i0 := 0 var i1 int = 1 var i2 NewInt = 1 ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || 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 type S struct { } func (p *S) M() { print("M\n"); } type I interface { ...
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 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 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=920 package main type X struct { x []X } func main() { type Y struc...
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=915 package main type T struct { x int } var t = &T{42} var i inter...
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=589 package main func main() { n := int64(100) x := make([]int, n)...
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 crash; issue 961. package main type ByteSize float64 const ( _ = iota; // ignore first value by assigning to blank ident...
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=589 package main import "unsafe" var bug = false var minus1 = -1 va...
Go
// errchk $G -e $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 U // bogus "invalid recursive type T" from 6g type U int const x T = 123 type V V // ERROR "invalid 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 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
// 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 struct{} type P *T func (t *T) Meth() {} func (t T) Meth2() {} func main() { t := &T{} p := P(t) p.Meth() // ...
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 1411. package main const ui uint = 0 const i int = ui // ERROR "type"
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
// $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=692 package main var fooCount = 0 var barCou...
Go
package Bar import _ "chanbug"
Go
package chanbug var C chan<- (chan int) var D chan<- func() var E func() chan int var F func() (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 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[0:]) // out of bounds trap if s...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: tuple evaluation order // 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 ...
Go
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug286 failed // 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 849. package main type I interface { f() } var callee string 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. 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
// $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=807 package main type Point struct { X, Y int64 } type Rect struct ...
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 float64 } } func mai...
Go
// $G $D/bug160.dir/x.go && $G $D/bug160.dir/y.go && $L y.$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...
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. // Used to crash // http://code.google.com/p/go/issues/detail?id=204 package main func () x() // ERROR "no receiver" func (a b, c d) 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
// $G $D/$F.dir/chanbug.go && $G -I. $D/$F.dir/chanbug2.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 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
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug254 // 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 a [10]int var b [1e1]int func main() { if len(a) != 10 || len(b) != 10 { prin...
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 h...
Go
// $G $D/$F.go || echo BUG: bug218 // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Crashes 6g, 8g // http://code.google.com/p/go/issues/detail?id=238 package main func main() { bar := make(chan bool); ...
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 || echo BUG: bug219 // Copyright 2009 The Go Authors. All 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()) int { return 0 } // this doesn't work: // bug219.go:16: syntax error near if func g1() { if x...
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); ...
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. // Test case for issue 471. This file shouldn't compile. package main const a *int = 1 // ERROR "convert|wrong|invalid" const...
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 1871. package p type a interface { foo(x int) (x int) // ERROR "redeclared|redefinition" } var b interface { bar(y int) (y...
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 true { } else { L1: } if true { } else { L2: main() } goto L1 goto L2 } /...
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. // https://code.google.com/p/gofrontend/issues/detail?id=1 package main func f1() { a, b := f() // ERROR "mismatch|does not match" _...
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=749 package main func f() (ok bool) { return false } func main() { ...
Go
// $G $D/$F.dir/b.go && $G $D/$F.dir/a.go // rm -f a.$A b.$A // 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 1705. unused (see script at top of file)
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=846 package main func x() (a int, b bool) { defer func(){ a++ }()...
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 type T1 struct { Next *T2 } type T2 T1 type T3 struct { Next *T4 } type T4 T5 type T5 T6 type T6 T7 ...
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 type T struct { x, Y int } func (t T) M()
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 y import "./x" func f() { ok := new(x.T); var ok1 x.T; ok2 := &ok1; ok3 := &x.T{}; ok4 := &x.T{Y:2}; _ = x.T{}; _ = x.T{Y:2}; ok1.M(); bad1...
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 ...
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
// $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. // This is a test case for issue 788. package main func main() { var a [1]complex64 t := a[0] _ = real(t) // 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 func main() { c := make(chan bool, 1); select { case _ = <-c: panic("BUG: recv should not"); defaul...
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 fo...
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") goto exit } func f2() { const c = 1234 } func f3() { i := c // ERROR "undef" } 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 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 float64) { i = 8 f = 8.0 return } func main() { f(3, float64(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: bug314 // 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 call wrong methods; issue 1290. package main type S struct { } func (S) a() int{ retur...
Go