]> Cypherpunks.ru repositories - gostls13.git/blob - test/declbad.go
Recognize gcco error messages.
[gostls13.git] / test / declbad.go
1 // errchk $G -e $F.go
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 // Incorrect short declarations and redeclarations.
8
9 package main
10
11 func f1() int { return 1 }
12 func f2() (float, int) { return 1, 2 }
13 func f3() (float, int, string) { return 1, 2, "3" }
14
15 func main() {
16         {
17                 // simple redeclaration
18                 i := f1();
19                 i := f1();      // ERROR "redeclared|redefinition"
20         }
21         {
22                 // change of type for f
23                 i, f, s := f3();        // GCCGO_ERROR "previous"
24                 f, g, t := f3();        // ERROR "redeclared|redefinition"
25         }
26         {
27                 // change of type for i
28                 i, f, s := f3();        // GCCGO_ERROR "previous"
29                 j, i, t := f3();        // ERROR "redeclared|redefinition"
30         }
31         {
32                 // no new variables
33                 i, f, s := f3();
34                 i, f := f2();   // ERROR "redeclared|redefinition"
35         }
36         {
37                 // single redeclaration
38                 i, f, s := f3();        // GCCGO_ERROR "previous"
39                 i := f1();              // ERROR "redeclared|redefinition"
40         }
41                 // double redeclaration
42         {
43                 i, f, s := f3();
44                 i, f := f2();   // ERROR "redeclared|redefinition"
45         }
46         {
47                 // triple redeclaration
48                 i, f, s := f3();
49                 i, f, s := f3();        // ERROR "redeclared|redefinition"
50         }
51 }