3 // Copyright 2010 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.
7 // Verify that incorrect invocations of the complex predeclared function are detected.
35 func F3() (int, int, int) {
41 c64 = complex(f32, f32)
42 c128 = complex(f64, f64)
44 _ = complex128(0) // ok
45 _ = complex(f32, f64) // ERROR "complex"
46 _ = complex(f64, f32) // ERROR "complex"
47 _ = complex(f32, F32) // ERROR "complex"
48 _ = complex(F32, f32) // ERROR "complex"
49 _ = complex(f64, F64) // ERROR "complex"
50 _ = complex(F64, f64) // ERROR "complex"
52 _ = complex(F1()) // ERROR "not enough arguments"
53 _ = complex(F3()) // ERROR "too many arguments"
55 _ = complex() // ERROR "not enough arguments"
57 c128 = complex(f32, f32) // ERROR "cannot use"
58 c64 = complex(f64, f64) // ERROR "cannot use"
60 c64 = complex(1.0, 2.0) // ok, constant is untyped
61 c128 = complex(1.0, 2.0)
62 C64 = complex(1.0, 2.0)
63 C128 = complex(1.0, 2.0)
65 C64 = complex(f32, f32) // ERROR "cannot use"
66 C128 = complex(f64, f64) // ERROR "cannot use"