| 1 |
// PR c++/103310 |
| 2 |
// Test that only manifestly-constant-evaluated comparisons lock a symbol's |
| 3 |
// weakness. |
| 4 |
|
| 5 |
// { dg-do compile { target c++17 } } |
| 6 |
// { dg-additional-options "-fdelete-null-pointer-checks" } |
| 7 |
|
| 8 |
extern void weakfn1 (void); |
| 9 |
extern void weakfn2 (void); |
| 10 |
|
| 11 |
void call_weakfn (void) |
| 12 |
{ |
| 13 |
if (weakfn1) |
| 14 |
weakfn1 (); |
| 15 |
if constexpr (weakfn2) |
| 16 |
weakfn2 (); |
| 17 |
} |
| 18 |
|
| 19 |
extern void weakfn1 (void) __attribute__((weak)); |
| 20 |
extern void weakfn2 (void) __attribute__((weak)); // { dg-error "declared weak after being used" } |