[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / complex-overload.cpp
blob9373e44de9504acda7d42ef86be08ecd9d46bc6f
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 char *foo(float);
4 void test_foo_1(float fv, double dv, float _Complex fc, double _Complex dc) {
5 char *cp1 = foo(fv);
6 char *cp2 = foo(dv);
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) {
16 char *cp1 = foo(fv);
17 char *cp2 = foo(dv);
18 int *ip = foo(fc);
19 int *lp = foo(dc);
22 long *foo(double _Complex);
24 void test_foo_3(float fv, double dv, float _Complex fc, double _Complex dc) {
25 char *cp1 = foo(fv);
26 char *cp2 = foo(dv);
27 int *ip = foo(fc);
28 long *lp = foo(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);