mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
![Cuong Manh Le](/assets/img/avatar_default.png)
In walkCompare, any ir.OCONVNOP was removed from both operands. So when constructing assignments for them to preserve any side-effects, using temporary variables can cause type mismatched with original type. Instead, using blank assignments will prevent that issue and still make sure that the operands will be evaluated. Fixes #52701 Change-Id: I229046acb154890bb36fe441d258563687fdce37 Reviewed-on: https://go-review.googlesource.com/c/go/+/403997 Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Robert Griesemer <gri@google.com>
17 lines
267 B
Go
17 lines
267 B
Go
// compile
|
|
|
|
// Copyright 2022 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 p
|
|
|
|
type T1 struct{}
|
|
type T2 struct{}
|
|
|
|
func f() {
|
|
switch (T1{}) {
|
|
case T1(T2{}):
|
|
}
|
|
}
|