1// Copyright 2023 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 5package a 6 7type S struct{} 8 9func callClosure(closure func()) { 10 closure() 11} 12 13func (s *S) M() { 14 callClosure(func() { 15 defer f(s.m) // prevent closures to be inlined. 16 }) 17} 18 19func (s *S) m() {} 20 21//go:noinline 22func f(a ...any) {} 23