~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to test/fixedbugs/issue4167.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// run
 
2
 
 
3
// Copyright 2012 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 4167: inlining of a (*T).Method expression taking
 
8
// its arguments from a multiple return breaks the compiler.
 
9
 
 
10
package main
 
11
 
 
12
type pa []int
 
13
 
 
14
type p int
 
15
 
 
16
func (this *pa) func1() (v *p, c int) {
 
17
        for _ = range *this {
 
18
                c++
 
19
        }
 
20
        v = (*p)(&c)
 
21
        return
 
22
}
 
23
 
 
24
func (this *pa) func2() p {
 
25
        return (*p).func3(this.func1())
 
26
}
 
27
 
 
28
func (this *p) func3(f int) p {
 
29
        return *this
 
30
}
 
31
 
 
32
func (this *pa) func2dots() p {
 
33
        return (*p).func3(this.func1())
 
34
}
 
35
 
 
36
func (this *p) func3dots(f ...int) p {
 
37
        return *this
 
38
}
 
39
 
 
40
func main() {
 
41
        arr := make(pa, 13)
 
42
        length := arr.func2()
 
43
        if int(length) != len(arr) {
 
44
                panic("length != len(arr)")
 
45
        }
 
46
        length = arr.func2dots()
 
47
        if int(length) != len(arr) {
 
48
                panic("length != len(arr)")
 
49
        }
 
50
}