Source file test/fixedbugs/issue58341.go

     1  // compile
     2  
     3  // Copyright 2023 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 p
     8  
     9  type S[T comparable] struct {
    10  	m map[T]T
    11  }
    12  
    13  func (s S[T]) M1(node T) {
    14  	defer delete(s.m, node)
    15  }
    16  
    17  func (s S[T]) M2(node T) {
    18  	defer func() {
    19  		delete(s.m, node)
    20  	}()
    21  }
    22  
    23  func (s S[T]) M3(node T) {
    24  	defer f(s.m, node)
    25  }
    26  
    27  //go:noinline
    28  func f[T comparable](map[T]T, T) {}
    29  
    30  var _ = S[int]{}
    31  

View as plain text