1 // RUN: %clang_cc1 -fsyntax-only -verify %s
4 void test_foo_1(float fv
, double dv
, float _Complex fc
, double _Complex dc
) {
7 // Note: GCC and EDG reject these two, they are valid C99 conversions but
8 // shouldn't be accepted in C++ because the result is surprising.
9 char *cp3
= foo(fc
); // expected-error {{implicit conversion from '_Complex float' to 'float' is not permitted in C++}}
10 char *cp4
= foo(dc
); // expected-error {{implicit conversion from '_Complex double' to 'float' is not permitted in C++}}
13 int *foo(float _Complex
);
15 void test_foo_2(float fv
, double dv
, float _Complex fc
, double _Complex dc
) {
22 long *foo(double _Complex
);
24 void test_foo_3(float fv
, double dv
, float _Complex fc
, double _Complex dc
) {
31 char *promote_or_convert(double _Complex
); // expected-note{{candidate function}}
32 int *promote_or_convert(long double _Complex
); // expected-note{{candidate function}}
34 void test_promote_or_convert(float f
, float _Complex fc
) {
35 char *cp
= promote_or_convert(fc
);
36 int *ip2
= promote_or_convert(f
); // expected-error{{call to 'promote_or_convert' is ambiguous}}
39 char *promote_or_convert2(float);
40 int *promote_or_convert2(double _Complex
);
42 void test_promote_or_convert2(float _Complex fc
) {
43 int *cp
= promote_or_convert2(fc
);
46 char *promote_or_convert3(int _Complex
); // expected-note {{candidate}}
47 int *promote_or_convert3(long _Complex
); // expected-note {{candidate}}
49 void test_promote_or_convert3(short _Complex sc
) {
50 char *cp1
= promote_or_convert3(sc
);
51 char *cp2
= promote_or_convert3(1i
);
52 int *cp3
= promote_or_convert3(1il
);
53 int *cp4
= promote_or_convert3(1ill
); // expected-error {{ambiguous}}
56 char &convert4(short _Complex
);
57 char &test_convert4
= convert4(1i
);