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. package main var ncall int; type Iffy interface { Me() Iffy } type Stucky struct { n int } func (s *Stucky) Me() Iffy { ncall++; return s } 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 func main() { x := 0 x = ^x // unary ^ not yet implemented if x != ^0 { println(x, " ", ^0) panic("fail") } } /* uetli:~/Source/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. // Troublesome floating point constants. Issue 1463. package main import "fmt" func check(test string, got, want float64) bool { if got != want { ...
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 1709 package main func main() { type Ts string var ts Ts _ = []byte(ts) } /* bug333.go:14: cannot use ts (type Ts) as ...
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. // gccgo crashed compiling this. package p type T *T func f(t T) { println(t, *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 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
// 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. // gc used to overflow a counter when a variable was // mentioned 256 times, and generate stack corruption. package main func main() { F(1) } func F...
Go
// $G $D/$F.dir/p.go && $G $D/$F.dir/main.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. // Issue 2716. Export metadata error made main.go not compile. package 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 const ( c3div2 = 3/2; f3div2 = 3./2.; ) func assert(t bool, s string) { if !t { panic(s) } } func main() { var i int; var...
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 frexp() (a int, b float64) { return 1, 2.0 } func main() { a, b := frexp(); _, _ = a, b; } /* bug056.go:8: illegal types for ope...
Go
// $G $D/$F.dir/one.go && $G $D/$F.dir/two.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
// 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/bugs gri$ 6g bug096.go && 6l bug...
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. // https://code.google.com/p/gofrontend/issues/detail?id=1 package main func f1() { a, b := f() // ERROR "mismatch|does not match" _ = a _ ...
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
// 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. // 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
// 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=920 package main type X struct { x []X } func main() { type Y struct { x []Y } // used to get inval...
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
// 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
// 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
// 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. // Some indirect uses of types crashed gccgo, because it assumed that // the size of the type was known before it had been computed. package p typ...
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 2009 The Go Authors. All 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 { f int; } // 6g used to get confused by the f:1 above // and allow uses of f that would be silently // dropped dur...
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 import "fmt" var s string func accum(args ...interface{}) { s += fmt.Sprintln(args...) } func f(){ v := 0.0 for i := 0; i < 3; i++ {...
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
// 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() { s := uint(10) ss := 1 << s y1 := float64(ss) y2 := float64(1 << s) // ERROR "shift" y3 := string(1 << s) // ERR...
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. // Used to call wrong methods; issue 1290. package main type S struct { } func (S) a() int{ return 0 } func (S) b() int{ return 1 } func main() { ...
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 2009 The Go Authors. All 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. // http://code.google.com/p/go/issues/detail?id=915 package main type T struct { x int } var t = &T{42} var i interface{} = t var tt, ok = i.(*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() { type M map[int] int; m1 := M{7 : 8}; _ = m1; }
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
// 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 len int; // len should not be a keyword - this doesn't compile _ = len; }
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
// 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
// cmpout // 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
// 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 one func Foo() (n int64, _ *int) { return 42, nil }
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 two import _ "./one"
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
// 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: 6} var v5 = T5{0: 7, 1: 8} var v6 = T2{f: 9} var v7 = T4{f: 10}...
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 main func f(args ...int) { g(args) } func g(args ...interface{}) { f(args) // ERROR "cannot use|incompatible" }
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
// 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 atom(s string) { if s == nil { // ERROR "nil|incompatible" return; } } func main() {} /* bug047.go:4: fatal error: strin...
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 "./lib" type I interface { M() } type PI interface { PM() } func main() { var t lib.T t.M() t.PM() // This is still an error. //...
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 lib type T struct { x int // non-exported field } func (t T) M() { } func (t *T) PM() { }
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 Alloc(i int) int { switch i { default: return 5; case 1: return 1; case 10: return 10; } return 0 } func main() { s :=...
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
// 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
// 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
// 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 T struct{ *p.S } type I interface { get() } func main() { var t T p.F(t) var x interface{} = t _, ok := x.(I) if ok ...
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 T struct{ x int } type S struct{} func (p *S) get() { } type I interface { get() } func F(i I) { i.get() }
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
// $G $D/$F.dir/p1.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out // 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 ignored
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 T struct { m map[int]int } func main() { t := new(T); t.m = make(map[int]int); var x int; var ok bool; x, ok = t.m[0]; //bug075...
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 {} func (x T) M () {} // ERROR "pointer|receiver" /* bug046.go:7: illegal <this> 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 import "testing" func main() { var t testing.T // make sure error mentions that // name is unexported, not just "name not fo...
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 f(i int, f float64) { i = 8 f = 8.0 return } func main() { f(3, float64(5)) } /* bug10.go:5: i undefined bug10.go:6: illegal 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 type I1 interface { I2 } // ERROR "interface" type I2 int type I3 interface { int } // ERROR "interface" type S struct { x inter...
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 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 no me...
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 x = '''; // ERROR "char"
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 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. func main() { // ERROR "package" }
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() { Foo: { return; } goto Foo; } /* bug5.go:4: Foo undefined bug5.go:4: fatal error: walktype: switch 1 unknown op GOTO l(4...
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" import "strconv" type Test struct { f float64 in string out string } var tests = []Test{ Test{123.5, "123.5", "123.5"...
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 s string = nil; // ERROR "illegal|invalid|incompatible|cannot" }
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
// 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
// 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() { // 6g used to compile these as two different // hash codes so it missed the duplication // and worse, compiled the...
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. // Test cases for revised conversion rules. package main func main() { type NewInt int i0 := 0 var i1 int = 1 var i2 NewInt = 1 i0 = i0 i...
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 run 6g out of registers. Issue 2669. package p type y struct { num int } func zzz () { k := make([]byte, 10) arr := make ([]*y...
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 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
// 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 v interface{} = 0; switch v.(type) { case int: fallthrough; // ERROR "fallthrough" default: panic("fell t...
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 const c = 1; func main() { c := 0; _ = c; } /* bug144.go:8: left side of := must be a name bug144.go:8: operation LITERAL not allo...
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 foo(a []int) int { return a[0] // this seems to do the wrong thing } func main() { a := &[]int{12} if x := (*a)[0]; x != 12 { p...
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 Element interface { } type Vector struct { } func (v *Vector) Insert(i int, e Element) { } func main() { type I struct { val int...
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 f0() { const x = 0; } func f1() { x := 0; _ = x; } func main() { f0(); f1(); } /* uetli:~/Source/go1/test/bugs gri$ 6g ...
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" func g() (foo int) { } // ERROR "return|control"
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 T struct { x, y int } func (t *T) m(a int, b float64) int { return (t.x + a) * (t.y + int(b)) } func main() { var t *T = new(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() { var u30 uint64 = 0; var u31 uint64 = 1; _, _ = u30, u31; var u32 uint64 = 18446744073709551615; var u33 uint64 = +1844...
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 2598 package foo return nil // ERROR "non-declaration statement outside function body|expected declaration"
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
// 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 1411. package main const ui uint = 0 const i int = ui // ERROR "type"
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. package main import "fmt" var a = []int64{ 0.0005 * 1e9, 0.001 * 1e9, 0.005 * 1e9, 0.01 * 1e9, 0.05 * 1e9, 0.1 * 1e9, 0.5 * 1e9, 1 * 1e9, 5 ...
Go
// build // Copyright 2009 The Go Authors. All 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 exit } /* uetli:~...
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 T1 struct { x, y int } type T2 struct { z, w byte } type T3 T1 type MyInt int func (MyInt) m(*T1) {} func main() { { var i in...
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 main type T U // bogus "invalid recursive type T" from 6g type U int const x T = 123 type V V // ERROR "invalid recursive type"
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. package main func main() { x := "" x = +"hello" // ERROR "invalid operation.*string|expected numeric" x = +x // ERROR "invalid operation.*...
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 import ( "runtime" "strings" ) var t *struct { c chan int } var c chan int func f() { select { case <-t.c: // THIS IS LINE 22 ...
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() { type T struct { s string f float64 } var s string = "hello" var f float64 = 0.2 t := T{s, f} type M map[int]int ...
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 f(a int64) int64 { const b int64 = 0; n := a &^ b; return n; } func main() { f(1) } /* bug156.go:7: constant 18446744073709...
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⊛y := 1; // ERROR "identifier" }
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 c chan int func main() { c = make(chan int); go func() { c <- 0 } (); <-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 // same const identifier declared twice should not be accepted const none = 0 // GCCGO_ERROR "previous" const none = 1; // ERROR ...
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 "fmt" var x = uint32(0x01020304) var y = [...]uint32{1,2,3,4,5} func main() { fmt.Sprint(y[byte(x)]) }
Go