]> Cypherpunks.ru repositories - gostls13.git/blob - test/fixedbugs/issue15042.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / fixedbugs / issue15042.go
1 // run
2
3 // Copyright 2016 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 // Exchanging two struct fields was compiled incorrectly.
8
9 package main
10
11 type S struct {
12         i int
13 }
14
15 func F(c bool, s1, s2 S) (int, int) {
16         if c {
17                 s1.i, s2.i = s2.i, s1.i
18         }
19         return s1.i, s2.i
20 }
21
22 func main() {
23         i, j := F(true, S{1}, S{20})
24         if i != 20 || j != 1 {
25                 panic(i+j)
26         }
27 }