1
0
mirror of https://github.com/golang/go synced 2024-11-13 19:00:25 -07:00
go/test/fixedbugs/issue11370.go
Anthony Canino 26c7b4fb1e cmd/compile: "abc"[1] is not an ideal constant
"abc"[1] is not like 'b', in that -"abc"[1] is uint8 math, not ideal constant math.
Delay the constantification until after ideal constant folding is over.

Fixes #11370.

Change-Id: Iba2fc00ca2455959e7bab8f4b8b4aac14b1f9858
Reviewed-on: https://go-review.googlesource.com/15740
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-13 17:41:04 +00:00

14 lines
286 B
Go

// compile
// Copyright 2015 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 11370: cmd/compile: "0"[0] should not be a constant
package p
func main() {
println(-"abc"[1] >> 1)
}