| 1 |
// run |
| 2 |
|
| 3 |
// Copyright 2018 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
// Issue 24503: Handle == and != of addresses taken of symbols consistently. |
| 8 |
|
| 9 |
package main |
| 10 |
|
| 11 |
func test() string { |
| 12 |
type test struct{} |
| 13 |
o1 := test{} |
| 14 |
o2 := test{} |
| 15 |
if &o1 == &o2 { |
| 16 |
return "equal" |
| 17 |
} |
| 18 |
if &o1 != &o2 { |
| 19 |
return "unequal" |
| 20 |
} |
| 21 |
return "failed" |
| 22 |
} |
| 23 |
|
| 24 |
func main() { |
| 25 |
if test() == "failed" { |
| 26 |
panic("expected either 'equal' or 'unequal'") |
| 27 |
} |
| 28 |
} |