Source file test/abi/defer_aggregate.go

     1  // run
     2  
     3  // Copyright 2021 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  package main
     8  
     9  const p0exp = "foo"
    10  const p1exp = 10101
    11  const p2exp = 3030303
    12  const p3exp = 505050505
    13  const p4exp = 70707070707
    14  
    15  //go:noinline
    16  //go:registerparams
    17  func callee(p0 string, p1 uint64, p2 uint64, p3 uint64, p4 uint64) {
    18  	if p0 != p0exp {
    19  		panic("bad p0")
    20  	}
    21  	if p1 != p1exp {
    22  		panic("bad p1")
    23  	}
    24  	if p2 != p2exp {
    25  		panic("bad p2")
    26  	}
    27  	if p3 != p3exp {
    28  		panic("bad p3")
    29  	}
    30  	if p4 != p4exp {
    31  		panic("bad p4")
    32  	}
    33  	defer func(p0 string, p2 uint64) {
    34  		if p0 != p0exp {
    35  			panic("defer bad p0")
    36  		}
    37  		if p1 != p1exp {
    38  			panic("defer bad p1")
    39  		}
    40  		if p2 != p2exp {
    41  			panic("defer bad p2")
    42  		}
    43  	}(p0, p2)
    44  }
    45  
    46  func main() {
    47  	callee(p0exp, p1exp, p2exp, p3exp, p4exp)
    48  }
    49  

View as plain text