...

Source file src/cmd/link/internal/ld/testdata/issue25459/a/a.go

Documentation: cmd/link/internal/ld/testdata/issue25459/a

     1  package a
     2  
     3  const Always = true
     4  
     5  var Count int
     6  
     7  type FuncReturningInt func() int
     8  
     9  var PointerToConstIf FuncReturningInt
    10  
    11  func ConstIf() int {
    12  	if Always {
    13  		return 1
    14  	}
    15  	var imdead [4]int
    16  	imdead[Count] = 1
    17  	return imdead[0]
    18  }
    19  
    20  func CallConstIf() int {
    21  	Count += 3
    22  	return ConstIf()
    23  }
    24  
    25  func Another() {
    26  	defer func() { PointerToConstIf = ConstIf; Count += 1 }()
    27  }
    28  

View as plain text