From 8abc6e25979ee75e6e01086b94d456255fbe6a4e Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 20 Jul 2023 15:45:24 -0700 Subject: go/types, types2: a min/max value argument must not be untyped Fixes #61486. Change-Id: I5770e238e44b724816894d914b3ea5dc78bc3ced Reviewed-on: https://go-review.googlesource.com/c/go/+/511835 Reviewed-by: Robert Griesemer Auto-Submit: Robert Griesemer Run-TryBot: Robert Griesemer Reviewed-by: Matthew Dempsky TryBot-Result: Gopher Robot --- src/cmd/compile/internal/types2/builtins.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/cmd/compile') diff --git a/src/cmd/compile/internal/types2/builtins.go b/src/cmd/compile/internal/types2/builtins.go index f3763862ec..7a209e7a97 100644 --- a/src/cmd/compile/internal/types2/builtins.go +++ b/src/cmd/compile/internal/types2/builtins.go @@ -576,6 +576,11 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) ( // If nargs == 1, make sure x.mode is either a value or a constant. if x.mode != constant_ { x.mode = value + // A value must not be untyped. + check.assignment(x, &emptyInterface, "argument to "+bin.name) + if x.mode == invalid { + return + } } // Use the final type computed above for all arguments. -- cgit v1.3-5-g9baa