code
stringlengths
10
1.34M
language
stringclasses
1 value
// 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. // used to panic because 6g didn't generate // the code to fill in the ... argument to fmt.Sprint. package main import "fmt" type T struct { a, b, c...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func f() int { // ERROR "return|control" if false { return 0; } // we should not be able to return successfully w/o a return s...
Go
// compile // Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Crashed gccgo. package p type S struct { f interface{} } func F(p *S) bool { v := p.f switch a := v.(type) { case nil: _ = a return t...
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { nchar := 0 a := []rune{'日', '本', '語', 0xFFFD} for _, char := range "日本語\xc0" { if nchar >= len(a) { println("BUG") ...
Go
// run // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test case for http://code.google.com/p/go/issues/detail?id=700 package main import "os" func f() (e int) { _ = &e return 999 } func main() { i...
Go
// run // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 1608. // Size used to be -1000000000. package main import "unsafe" func main() { var a interface{} = 0 size := unsafe.Sizeof(a) if size ...
Go
// $G -N -o slow.$A $D/bug369.dir/pkg.go && // $G -o fast.$A $D/bug369.dir/pkg.go && // run // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test that compiling with optimization turned on produces faster...
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import "time" func main() { var count int c := make(chan byte) go func(c chan byte) { <-c count++ time.Sleep(1000000) count++ ...
Go
// errorcheck // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 2276. // Check that the error messages says // bug381.go:29: unsafe.Alignof(0) not used // and not // bug381.go:29: 4 not used // Is...
Go
// run // Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Test using _ receiver. Failed with gccgo. package main type S struct {} func (_ S) F(i int) int { return i } func main() { s := S{} const c =...
Go
// errorcheck // Copyright 2009 The Go Authors. All 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 [10]int; v...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main type T struct { 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
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main type S string type I int type F float64 func (S) m() {} func (I) m() {} func (F) m() {} func main() { c := make(chan interface { m()...
Go
// compile // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 1368. package main func main() { a := complex(2, 2) a /= 2 } /* bug315.go:13: internal compiler error: optoas: no entry DIV-complex */...
Go
// run // Copyright 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) var i interface{} = Count j := i.(int) if j != Co...
Go
// run // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "errors" "strconv" ) var trace string func f() string { trace += "f" return "abc" } func g() *error { trace += "g" var x...
Go
// run // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // http://code.google.com/p/go/issues/detail?id=800 package main var log string type T int func (t T) a(s string) T { log += "a(" + s + ")" retur...
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { bad := false if (-5 >> 1) != -3 { println("-5>>1 =", -5>>1, "want -3") bad = true } if (-4 >> 1) != -2 { println("...
Go
// errorcheck // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // check that compiler doesn't stop reading struct def // after first unknown type. // Fixes issue 2110. package main type S struct { err fo...
Go
// 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. package main type T []int func (t T) m() func main() { _ = T{} } // bug245.go:14: fatal error: method mismatch: T for T
Go
// run // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 2355 package main type T struct {} func (T) m() string { return "T" } type TT struct { T m func() string } func ff() string { return "ff...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main type T func() type I interface { f, g (); // ERROR "name list not allowed" } type J interface { h T; // ERROR "syntax|signatur...
Go
// 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. // these used to fail because the runtime // functions that get called to implement them // expected string, not T. package main type T string fun...
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import "fmt" var indent uint = 10 func main() { const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " + ". ...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main // same const identifier declared twice should not be accepted const none = 0 // GCCGO_ERROR "previous" const none = 1; // ERROR ...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func f (x, // GCCGO_ERROR "previous" x int) { // ERROR "redeclared|redefinition" "duplicate" }
Go
// run // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // issue 1900 package main func getArgs(data map[string]interface{}, keys ...string) map[string]string { ret := map[string]string{} var...
Go
// run // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main var f = func() int { type S int return 42 } func main() { if f() != 42 { panic("BUG: bug355") } }
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main const X = iota func f(x int) { } func main() { f(X); f(iota); // ERROR "iota" f(X); }
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func f(x int, y ...int) // ok func g(x int, y float) (...) // ERROR "[.][.][.]" "final argument" func h(x, y ...int) // ERROR "...
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // function call arg reordering was picking out 1 call that // didn't need to be in a temporary, but it was picking // out the first call instead of the...
Go
// run // Copyright 2009 The Go Authors. All 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
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func f() { a := true; a |= a; // ERROR "illegal.*OR|bool|expected" }
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package one type T1 int type T2 []T1 type T3 T2 func F1(T2) { } func (p *T1) M1() T3 { return nil } func (p T3) M2() { }
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // The gccgo compiler would fail on the import statement. // two.go:10:13: error: use of undefined type ‘one.T2’ package two import "./one" var V one.T3
Go
// errorcheck // Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 3044. // Multiple valued expressions in return lists. package p func Two() (a, b int) // F used to compile. func F() (x interface{}, ...
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
// compile // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 2549 /* Used to die with missing typecheck: [7f5bf07b4438] . AS l(45) . . NAME-main.autotmp_0017 u(1) a(1) l(45) x(0+0) class(PAU...
Go
// compile // Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Used to crash compiler in interface type equality check. package p type I1 interface { F() interface{I1} } type I2 interface { F(...
Go
// run // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // http://code.google.com/p/go/issues/detail?id=799 package main import "unsafe" func main() { n := unsafe.Sizeof(0) if n != 4 && n != 8 { print...
Go
// $G $D/$F.dir/io.go && errchk $G -e $D/$F.dir/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 ignored
Go
// [ $A != 6 ] || 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. // Issue 2444 package main func main() { // ERROR "stack frame too large" var arr [1000200030]int arr_bkup := arr...
Go
// run // Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 2821 package main type matrix struct { e []int } func (a matrix) equal() bool { for _ = range a.e { } return true } func main() { var ...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func putint(digits *string) { var i byte; i = (*digits)[7]; // compiles i = digits[7]; // ERROR "illegal|is not|invalid" _ = ...
Go
// run // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main var nf int var ng int func f() (int, int, int) { nf++ return 1, 2, 3 } func g() int { ng++ return 4 } var x, y, z = f() var m = mak...
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import "fmt" type Element interface { } type Vector struct { nelem int elem []Element } func New() *Vector { v := new(Vector) v.ne...
Go
// run // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { c := make(chan int, 1) dummy := make(chan int) v := 0x12345678 for i := 0; i < 10; i++ { // 6g had a bug that caused ...
Go
// compile // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { x := 0; // this compiles switch x { case 0: } // this doesn't but should switch 0 { case 0: } } /* bug158.g...
Go
// run // Copyright 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 1808 package main func main() { var i uint64 var x int = 12345 if y := x << (i&5); y != 12345<<0 { println("BUG bug344", y) return ...
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import "os" func main() { m := make(map[int]int); m[0] = 0; m[0]++; if m[0] != 1 { print("map does not increment\n"); os.Exit(1) ...
Go
// compile // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // http://code.google.com/p/go/issues/detail?id=990 package main func main() { defer func() { if recover() != nil { panic("non-nil recover"...
Go
// compile // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // issue 1908 // unreasonable width used to be internal fatal error package test func main() { buf := [1<<30]byte{} _ = buf[:] }
Go
// compile // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { L1: L2: for i := 0; i < 10; i++ { print(i) break L2 } L3: ; L4: for i := 0; i < 10; i++ { print(i) break L4...
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
// 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
// run // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // http://code.google.com/p/go/issues/detail?id=843 package main import "unsafe" type T struct { X, Y uint8 } func main() { var t T if unsafe.Of...
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import "os" const ( x float64 = iota g float64 = 4.5 * iota ) func main() { if g == 0.0 { print("zero\n") } if g != 4.5 { print...
Go
// errorcheck // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ddd func Sum() int for i := range []int{} { return i } // ERROR "statement outside function|expected"
Go
// run // Copyright 2009 The Go Authors. All 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 (p *S) send(c chan <- int) { c <- p.v } func main() { ...
Go
// errorcheck // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 2451, 2452 package foo func f() error { return 0 } // ERROR "cannot use 0 .type int.|has no methods" func g() error { return -1 } /...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { var x int64 = 0; println(x != nil); // ERROR "illegal|incompatible|nil" println(0 != nil); // ERROR "illegal|incomp...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { L: ; // ';' terminates empty statement => L does not apply to for loop for i := 0; i < 10; i++ { println(i); b...
Go
// compile // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { x := false; func () { if x { println(1); } }(); // this does not compile func () { if x == false { println(...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main const x x = 2 // ERROR "loop|type" /* bug081.go:3: first constant must evaluate an expression Bus error */
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { var 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
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import "sort" func main() { sort.Sort(nil); var x int; sort(x); // ERROR "package" }
Go
// compile // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 1716 package main type ( cplx64 complex64 cplx128 complex128 ) func (c cplx64) Foo() {} func (c cplx128) Foo() {} func main() { v...
Go
// run // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Conversion between identical interfaces. // Issue 1647. // The compiler used to not realize this was a no-op, // so it generated a call to the non-...
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
// compile // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // issue 1136 package main import "fmt" func log1(f string, argv ...interface{}) { fmt.Printf("log: %s\n", fmt.Sprintf(f, argv...)) } func mai...
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package p1 type T struct { f func() "x" }
Go
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package p2 import _ "./p1"
Go
// errorcheck // Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package p type t struct { x int // ERROR "duplicate field x" x int } func f(t *t) int { return t.x // ERROR "ambiguous selector t.x" }
Go
// compile // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func swap(x, y int) (u, v int) { return y, x } func main() { a := 1; b := 2; a, b = swap(swap(a, b)); if a != 2 || b != 1 { pa...
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { var x int; switch x { case 0: {} case 1: x = 0; } } /* bug0.go:8: case statement out of place */
Go
// compile // Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Issue 1811. // gccgo failed to compile this. package p type E interface{} type I interface { E E }
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main var gen = 'a' func f(n int) string { s := string(gen) + string(n+'A'-1) gen++ return s } func g(x, y string) string { return x + y }...
Go
// compile // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main type myMap map[string] int; func f() myMap { m := make(map[string] int); return m } func main() { m := make(myMap); mp := &m; ...
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { c := make(chan int, 1) c <- 100 x, ok := <-c if x != 100 || !ok { println("x=", x, " ok=", ok, " want 100, true") p...
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
// run // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main // issue 2337 // The program deadlocked. import "runtime" func main() { runtime.GOMAXPROCS(2) runtime.GC() runtime.GOMAXPROCS(1) }
Go
// 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 bug066 type Scope struct { entries map[string] *Object; } type Type struct { scope *Scope; } type Object struct { typ *Type; } fun...
Go
// compile // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package bug267 type T []int var a []bool func _() { if a[T{42}[0]] { } // if (a[T{42}[0]]) {} // this compiles } /* 6g bugs/bug267.go bugs/b...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main type T *struct { T; // ERROR "embed.*pointer" }
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main var c1 chan <- chan int = (chan<- (chan int))(nil) var c2 chan <- chan int = (chan (<-chan int))(nil) // ERROR "chan|incompatible...
Go
// 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 g byte = 123 var f *byte = &g var b = make([]byte, 5) func main() { b[0:1][0] = *f if b[0] != 123 { println("want 123 got", b[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
// run // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func f() int { defer func() { recover() }() panic("oops") } func g() int { return 12345 } func main() { g() // leave 12345 on s...
Go
// Copyright 2009 The Go Authors. 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
// errorcheck // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Used to die dividing by zero; issue 879. package main var mult [3][...]byte = [3][5]byte{} // ERROR "\.\.\."
Go
// run // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { var a [1000] int64; // this alone works var b [10000] int64; // this causes a runtime crash _, _ = a, b; } /* uetli:~/...
Go
// errorcheck // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func main() { x := string{'a', 'b', '\n'}; // ERROR "composite" print(x); }
Go