/
githubmirror
/
go
Обзор
Документация
Войти
/
githubmirror
/
go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/fixedbugs/issue78404.go
37 строк
601 B
Mateusz Poliwczak
cmd/compile/internal/devirtualize: use pointer identity for type comparison
30 мар 2026, 17:27
30 мар 2026, 17:27
09031d9
Код
Авторство
О чём код?
// run // Copyright 2026 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. package main type Iface[IO any] interface { Foo() } type underlyingIfaceImpl struct{} func (e *underlyingIfaceImpl) Foo() {} type Impl1[IO any] struct { underlyingIfaceImpl } type Impl2 struct { underlyingIfaceImpl } func NewImpl1[IO any]() Iface[IO] { return &Impl1[IO]{} } var alwaysFalse = false func main() { val := NewImpl1[int]() if alwaysFalse { // dead branch val = &Impl2{} } val.Foo() // must not panic }