Home | History | Annotate | Download | only in bug465.dir
      1 // Copyright 2012 The Go Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style
      3 // license that can be found in the LICENSE file.
      4 
      5 package a
      6 
      7 type T struct{ A, B int }
      8 
      9 type A []int
     10 
     11 type M map[int]int
     12 
     13 func F1() int {
     14 	if (T{1, 2}) == (T{3, 4}) {
     15 		return 1
     16 	}
     17 	return 0
     18 }
     19 
     20 func F2() int {
     21 	if (M{1: 2}) == nil {
     22 		return 1
     23 	}
     24 	return 0
     25 }
     26 
     27 func F3() int {
     28 	if nil == (A{}) {
     29 		return 1
     30 	}
     31 	return 0
     32 }
     33 
     34 func F4() int {
     35 	if a := (A{}); a == nil {
     36 		return 1
     37 	}
     38 	return 0
     39 }
     40 
     41 func F5() int {
     42 	for k, v := range (M{1: 2}) {
     43 		return v - k
     44 	}
     45 	return 0
     46 }
     47 
     48 func F6() int {
     49 	switch a := (T{1, 1}); a == (T{1, 2}) {
     50 	default:
     51 		return 1
     52 	}
     53 	return 0
     54 }
     55 
     56 func F7() int {
     57 	for m := (M{}); len(m) < (T{1, 2}).A; m[1] = (A{1})[0] {
     58 		return 1
     59 	}
     60 	return 0
     61 }
     62 
     63 func F8() int {
     64 	if a := (&T{1, 1}); a != nil {
     65 		return 1
     66 	}
     67 	return 0
     68 }
     69 
     70 func F9() int {
     71 	var a *T
     72 	if a = (&T{1, 1}); a != nil {
     73 		return 1
     74 	}
     75 	return 0
     76 }
     77