/
githubmirror
/
go
Обзор
Документация
Войти
/
githubmirror
/
go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/fixedbugs/issue38496.go
20 строк
440 B
Josh Bleecher Snyder
test: add test for nil check / bounds check compiler confusion
17 апр 2020, 07:26
17 апр 2020, 07:26
29d925d
Код
Авторство
О чём код?
// run // Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Make sure bounds check elision isn't confused with nil check elision. package main func main() { defer func() { err := recover() if err == nil { panic("failed to check nil ptr") } }() var m [2]*int _ = *m[1] // need a nil check, but not a bounds check }