Re: [go-nuts] Panic getting swallowed by defer in Go 1.11

2018-09-03 Thread amanda
NB I’m unable to reproduce this bug without the pointer indirection. On Tuesday, September 4, 2018 at 3:38:35 AM UTC+10, Sam Whited wrote: > > On Mon, Sep 3, 2018, at 04:10, ama...@naucera.net wrote: > > type S []int > > > > func (s *S) Last() int { > > return (*s)[len(*s) - 1] > > } >

Re: [go-nuts] Panic getting swallowed by defer in Go 1.11

2018-09-03 Thread amanda
NB I']m On Tuesday, September 4, 2018 at 3:38:35 AM UTC+10, Sam Whited wrote: > > On Mon, Sep 3, 2018, at 04:10, ama...@naucera.net wrote: > > type S []int > > > > func (s *S) Last() int { > > return (*s)[len(*s) - 1] > > } > > On an unrelated matter, the extra indirection is (probably)

Re: [go-nuts] Panic getting swallowed by defer in Go 1.11

2018-09-03 Thread amanda
Thanks, that looks like what I’m seeing (I’m able to coax it to produce a pointer which segfaults the runtime). On Tuesday, September 4, 2018 at 3:34:43 AM UTC+10, Paul Jolly wrote: > > I suspect that you've just run into some variation on > https://github.com/golang/go/issues/27378 > > Giovan

[go-nuts] Panic getting swallowed by defer in Go 1.11

2018-09-03 Thread amanda
Hi all, Since Go 1.11, the following test seems to pass when I would expect it to panic with index out of range: package weirdness import "testing" type S []int func (s *S) Last() int { return (*s)[len(*s) - 1] } func TestWeirdness(t *testing.T) { var s S defer func() {}()