Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Chandler Carruth | 23a370f | 2010-02-25 07:20:54 +0000 | [diff] [blame] | 2 | char *foo(float); |
Douglas Gregor | 5cdf821 | 2009-02-12 00:15:05 +0000 | [diff] [blame] | 3 | |
| 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, but they are valid C99 conversions |
| 8 | char *cp3 = foo(fc); |
| 9 | char *cp4 = foo(dc); |
| 10 | } |
| 11 | |
Chandler Carruth | 23a370f | 2010-02-25 07:20:54 +0000 | [diff] [blame] | 12 | int *foo(float _Complex); |
Douglas Gregor | 5cdf821 | 2009-02-12 00:15:05 +0000 | [diff] [blame] | 13 | |
| 14 | void test_foo_2(float fv, double dv, float _Complex fc, double _Complex dc) { |
| 15 | char *cp1 = foo(fv); |
Chandler Carruth | 23a370f | 2010-02-25 07:20:54 +0000 | [diff] [blame] | 16 | char *cp2 = foo(dv); |
Douglas Gregor | 5cdf821 | 2009-02-12 00:15:05 +0000 | [diff] [blame] | 17 | int *ip = foo(fc); |
Chandler Carruth | 23a370f | 2010-02-25 07:20:54 +0000 | [diff] [blame] | 18 | int *lp = foo(dc); |
Douglas Gregor | 5cdf821 | 2009-02-12 00:15:05 +0000 | [diff] [blame] | 19 | } |
| 20 | |
Chandler Carruth | 23a370f | 2010-02-25 07:20:54 +0000 | [diff] [blame] | 21 | long *foo(double _Complex); |
Douglas Gregor | 5cdf821 | 2009-02-12 00:15:05 +0000 | [diff] [blame] | 22 | |
| 23 | void test_foo_3(float fv, double dv, float _Complex fc, double _Complex dc) { |
| 24 | char *cp1 = foo(fv); |
Chandler Carruth | 23a370f | 2010-02-25 07:20:54 +0000 | [diff] [blame] | 25 | char *cp2 = foo(dv); |
Douglas Gregor | 5cdf821 | 2009-02-12 00:15:05 +0000 | [diff] [blame] | 26 | int *ip = foo(fc); |
| 27 | long *lp = foo(dc); |
| 28 | } |
| 29 | |
| 30 | char *promote_or_convert(double _Complex); // expected-note{{candidate function}} |
| 31 | int *promote_or_convert(long double _Complex); // expected-note{{candidate function}} |
| 32 | |
| 33 | void test_promote_or_convert(float f, float _Complex fc) { |
| 34 | char *cp = promote_or_convert(fc); |
Richard Trieu | 2fe9b7f | 2011-12-15 00:38:15 +0000 | [diff] [blame] | 35 | int *ip2 = promote_or_convert(f); // expected-error{{call to 'promote_or_convert' is ambiguous}} |
Douglas Gregor | 5cdf821 | 2009-02-12 00:15:05 +0000 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | char *promote_or_convert2(float); |
| 39 | int *promote_or_convert2(double _Complex); |
| 40 | |
Douglas Gregor | b7b5d13 | 2009-02-12 00:26:06 +0000 | [diff] [blame] | 41 | void test_promote_or_convert2(float _Complex fc) { |
Douglas Gregor | 5cdf821 | 2009-02-12 00:15:05 +0000 | [diff] [blame] | 42 | int *cp = promote_or_convert2(fc); |
| 43 | } |
Douglas Gregor | b7b5d13 | 2009-02-12 00:26:06 +0000 | [diff] [blame] | 44 | |
| 45 | char *promote_or_convert3(int _Complex); |
| 46 | int *promote_or_convert3(long _Complex); |
| 47 | |
| 48 | void test_promote_or_convert3(short _Complex sc) { |
| 49 | char *cp = promote_or_convert3(sc); |
| 50 | } |