Lang Hames | 2cad9e3 | 2011-12-08 19:26:24 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -x c++ -verify -fsyntax-only %s |
| 2 | |
| 3 | void f1(); |
| 4 | |
| 5 | struct S { |
| 6 | static void f2(); |
| 7 | }; |
| 8 | |
| 9 | extern void f3() __attribute__((weak_import)); |
| 10 | |
| 11 | struct S2 { |
| 12 | static void f4() __attribute__((weak_import)); |
| 13 | }; |
| 14 | |
| 15 | void bar() { |
| 16 | bool b; |
| 17 | |
| 18 | b = f1; // expected-warning {{address of function 'f1' will always evaluate to 'true'}} |
| 19 | if (f1) {} // expected-warning {{address of function 'f1' will always evaluate to 'true'}} |
| 20 | b = S::f2; // expected-warning {{address of function 'S::f2' will always evaluate to 'true'}} |
| 21 | if (S::f2) {} // expected-warning {{address of function 'S::f2' will always evaluate to 'true'}} |
| 22 | |
| 23 | // implicit casts of weakly imported symbols are ok: |
| 24 | b = f3; |
| 25 | if (f3) {} |
| 26 | b = S2::f4; |
| 27 | if (S2::f4) {} |
| 28 | } |