blob: c06bd74438373a92a900b3273dbd3a369a0f611a [file] [log] [blame]
Russ Cox0b477ef2012-02-16 23:48:57 -05001// errorcheck
Russ Cox1163b1d2008-10-16 15:59:31 -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
Rob Pikefc0dc042012-02-19 13:19:43 +11007// Verify that illegal uses of composite literals are detected.
8// Does not compile.
9
Russ Cox1163b1d2008-10-16 15:59:31 -070010package main
11
Russ Cox9dc22b62009-08-03 11:58:52 -070012var a = []int { "a" }; // ERROR "conver|incompatible|cannot"
Russ Coxbe2edb52009-03-03 08:39:12 -080013var b = int { 1 }; // ERROR "compos"
Russ Cox1163b1d2008-10-16 15:59:31 -070014
15
Russ Coxf48cbfd2009-01-16 16:12:14 -080016func f() int
17
Russ Cox1163b1d2008-10-16 15:59:31 -070018func main() {
Russ Cox9dc22b62009-08-03 11:58:52 -070019 if f < 1 { } // ERROR "conver|incompatible|invalid"
Russ Cox1163b1d2008-10-16 15:59:31 -070020}