Source file test/fixedbugs/issue19246.go

     1  // run
     2  
     3  // Copyright 2017 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  // Issue 19246: Failed to evaluate some zero-sized values
     8  // when converting them to interfaces.
     9  
    10  package main
    11  
    12  import "os"
    13  
    14  type B struct{}
    15  
    16  //go:noinline
    17  func f(i interface{}) {}
    18  
    19  func main() {
    20  	defer func() {
    21  		if recover() == nil {
    22  			println("expected nil pointer dereference panic")
    23  			os.Exit(1)
    24  		}
    25  	}()
    26  	var b *B
    27  	f(*b)
    28  }
    29  

View as plain text