blob: 65a8bfe9a1989a732ba8ee4f84fda84484f8d1ea [file] [log] [blame]
Russ Cox0b477ef2012-02-16 23:48:57 -05001// errorcheck
Rob Pike094ee442008-06-06 16:56:18 -07002
3// Copyright 2009 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7package main
8
9func putint(digits *string) {
10 var i byte;
11 i = (*digits)[7]; // compiles
Russ Cox9dc22b62009-08-03 11:58:52 -070012 i = digits[7]; // ERROR "illegal|is not|invalid"
Russ Coxae54cf72009-09-15 12:42:24 -070013 _ = i;
Rob Pike094ee442008-06-06 16:56:18 -070014}
15
Rob Pikebf14ef62008-07-07 10:03:10 -070016func main() {
17 s := "asdfasdfasdfasdf";
18 putint(&s);
19}
20
Rob Pike094ee442008-06-06 16:56:18 -070021/*
22bug022.go:8: illegal types for operand
23 (*<string>*STRING) INDEXPTR (<int32>INT32)
24bug022.go:8: illegal types for operand
Russ Cox4c5c0f42009-06-25 14:44:09 -070025 (<uint8>UINT8) AS
Rob Pike094ee442008-06-06 16:56:18 -070026*/