Russ Cox | 0b477ef | 2012-02-16 23:48:57 -0500 | [diff] [blame] | 1 | // errorcheck |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 2 | |
| 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 | |
| 7 | package main |
| 8 | |
| 9 | func putint(digits *string) { |
| 10 | var i byte; |
| 11 | i = (*digits)[7]; // compiles |
Russ Cox | 9dc22b6 | 2009-08-03 11:58:52 -0700 | [diff] [blame] | 12 | i = digits[7]; // ERROR "illegal|is not|invalid" |
Russ Cox | ae54cf7 | 2009-09-15 12:42:24 -0700 | [diff] [blame] | 13 | _ = i; |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 14 | } |
| 15 | |
Rob Pike | bf14ef6 | 2008-07-07 10:03:10 -0700 | [diff] [blame] | 16 | func main() { |
| 17 | s := "asdfasdfasdfasdf"; |
| 18 | putint(&s); |
| 19 | } |
| 20 | |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 21 | /* |
| 22 | bug022.go:8: illegal types for operand |
| 23 | (*<string>*STRING) INDEXPTR (<int32>INT32) |
| 24 | bug022.go:8: illegal types for operand |
Russ Cox | 4c5c0f4 | 2009-06-25 14:44:09 -0700 | [diff] [blame] | 25 | (<uint8>UINT8) AS |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 26 | */ |