2012-02-17 04:48:57 +00:00
|
|
|
// errorcheck
|
2008-10-16 22:59:31 +00:00
|
|
|
|
|
|
|
// Copyright 2009 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.
|
|
|
|
|
2012-02-19 02:19:43 +00:00
|
|
|
// Verify that illegal uses of composite literals are detected.
|
|
|
|
// Does not compile.
|
|
|
|
|
2008-10-16 22:59:31 +00:00
|
|
|
package main
|
|
|
|
|
2009-08-03 18:58:52 +00:00
|
|
|
var a = []int { "a" }; // ERROR "conver|incompatible|cannot"
|
2009-03-03 16:39:12 +00:00
|
|
|
var b = int { 1 }; // ERROR "compos"
|
2008-10-16 22:59:31 +00:00
|
|
|
|
|
|
|
|
2009-01-17 00:12:14 +00:00
|
|
|
func f() int
|
|
|
|
|
2008-10-16 22:59:31 +00:00
|
|
|
func main() {
|
2009-08-03 18:58:52 +00:00
|
|
|
if f < 1 { } // ERROR "conver|incompatible|invalid"
|
2008-10-16 22:59:31 +00:00
|
|
|
}
|