Commit 6a393dc6 authored by Martin Möhrmann's avatar Martin Möhrmann Committed by Martin Möhrmann

cmd/compile: fix compilation of math.Sqrt when used as a statement

Fixes #16804

Change-Id: I669c2c24d3135cd35e15a464894ac66945847d0c
Reviewed-on: https://go-review.googlesource.com/27437Reviewed-by: 's avatarKeith Randall <khr@golang.org>
Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 2f783c34
......@@ -966,6 +966,9 @@ func (s *state) stmt(n *Node) {
p := s.expr(n.Left)
s.nilCheck(p)
case OSQRT:
s.expr(n.Left)
default:
s.Unimplementedf("unhandled stmt %s", n.Op)
}
......
// compile
// Copyright 2016 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.
// Issue 16804: internal error for math.Sqrt as statement
// rather than expression
package main
import "math"
func sqrt() {
math.Sqrt(2.0)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment