blob: 2606b4da953deb71d7b1140df6ab3ed0d84e5055 [file] [log] [blame]
Lang Hames2cad9e32011-12-08 19:26:24 +00001// RUN: %clang_cc1 -x c++ -verify -fsyntax-only %s
2
3void f1();
4
5struct S {
6 static void f2();
7};
8
9extern void f3() __attribute__((weak_import));
10
11struct S2 {
12 static void f4() __attribute__((weak_import));
13};
14
15void 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}