1// run
2
3// Copyright 2009 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
7package main
8
9type S struct {
10}
11
12func (p *S) M() {
13}
14
15type I interface {
16	M();
17}
18
19func main() {
20	var p *S = nil;
21	var i I = p;  // this should be possible even though p is nil: we still know the type
22	i.M();  // should be possible since we know the type, and don't ever use the receiver
23}
24
25
26/*
27throw: ifaces2i: nil pointer
28SIGSEGV: segmentation violation
29Faulting address: 0x0
30pc: 0x1b7d
31
320x1b7d?zi
33	throw(30409, 0, 0, ...)
34	throw(0x76c9, 0x0, 0x0, ...)
350x207f?zi
36	sys·ifaces2i(31440, 0, 31480, ...)
37	sys·ifaces2i(0x7ad0, 0x7af8, 0x0, ...)
380x136f?zi
39	main·main(1, 0, 1606416424, ...)
40	main·main(0x1, 0x7fff5fbff828, 0x0, ...)
41
42rax     0x1
43rbx     0x1
44rcx     0x33b5
45rdx     0x0
46rdi     0x1
47rsi     0x7684
48rbp     0x7684
49rsp     0xafb8
50r8      0x0
51r9      0x0
52r10     0x1002
53r11     0x206
54r12     0x0
55r13     0x0
56r14     0x7c48
57r15     0xa000
58rip     0x1b7d
59rflags  0x10202
60cs      0x27
61fs      0x10
62gs      0x48
63*/
64