Commit 93c4e296 authored by Luuk van Dijk's avatar Luuk van Dijk

gc: missed typecheck in subscripting a const string.

Fixes #2674.

R=rsc
CC=golang-dev
https://golang.org/cl/5574045
parent 5ad9e2db
...@@ -876,6 +876,7 @@ walkexpr(Node **np, NodeList **init) ...@@ -876,6 +876,7 @@ walkexpr(Node **np, NodeList **init)
// delayed until now because "abc"[2] is not // delayed until now because "abc"[2] is not
// an ideal constant. // an ideal constant.
nodconst(n, n->type, n->left->val.u.sval->s[v]); nodconst(n, n->type, n->left->val.u.sval->s[v]);
n->typecheck = 1;
} }
} }
goto ret; goto ret;
......
// $G $D/$F.go || echo "Bug399"
// Copyright 2011 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 2674
package main
const dow = "\000\003"
func main() {
println(int(dow[1]))
}
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