test/fixedbugs/issue72860.go
raw| 1 | // run |
| 2 | |
| 3 | // Copyright 2025 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 | //go:noinline |
| 10 | func f(p *int, b bool) int { |
| 11 | valid := *p >= 0 |
| 12 | if !b || !valid { |
| 13 | return 5 |
| 14 | } |
| 15 | return 6 |
| 16 | } |
| 17 | func main() { |
| 18 | defer func() { |
| 19 | if e := recover(); e == nil { |
| 20 | println("should have panicked") |
| 21 | } |
| 22 | }() |
| 23 | f(nil, false) |
| 24 | } |