| 1 |
/* PR c/33925 - missing -Waddress with the address of an inline function |
| 2 |
{ dg-do compile } |
| 3 |
{ dg-options "-Wall" } */ |
| 4 |
|
| 5 |
struct A |
| 6 |
{ |
| 7 |
int mf (); |
| 8 |
int mf_def () { return 0; } |
| 9 |
|
| 10 |
static int smf (); |
| 11 |
static int smf_def () { return 0; } |
| 12 |
|
| 13 |
int mi; |
| 14 |
static int smi; |
| 15 |
static int smi_def; |
| 16 |
|
| 17 |
__attribute__ ((weak)) static int wsmi; |
| 18 |
__attribute__ ((weak)) static int wsmi_def; |
| 19 |
|
| 20 |
int mia[]; |
| 21 |
static int smia[]; |
| 22 |
static int smia_def[]; |
| 23 |
|
| 24 |
__attribute__ ((weak)) static int wsmia[]; |
| 25 |
__attribute__ ((weak)) static int wsmia_def[]; |
| 26 |
|
| 27 |
void test_waddress (bool*); |
| 28 |
}; |
| 29 |
|
| 30 |
|
| 31 |
/* __attribute__ ((weak)) static */ int A::smi_def = 0; |
| 32 |
/* __attribute__ ((weak)) static */ int A::smia_def[] = { 0 }; |
| 33 |
|
| 34 |
/* __attribute__ ((weak)) static */ int A::wsmi_def = 0; |
| 35 |
/* __attribute__ ((weak)) static */ int A::wsmia_def[] = { 0 }; |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
void A::test_waddress (bool *p) |
| 40 |
{ |
| 41 |
if (mf) // { dg-error "cannot convert" } |
| 42 |
p++; |
| 43 |
if (mf_def) // { dg-error "cannot convert" } |
| 44 |
p++; |
| 45 |
|
| 46 |
if (smf) // { dg-warning "-Waddress" } |
| 47 |
p++; |
| 48 |
if (smf_def) // { dg-warning "-Waddress" } |
| 49 |
p++; |
| 50 |
|
| 51 |
if (&mi) // { dg-warning "-Waddress" } |
| 52 |
p++; |
| 53 |
if (&smi) // { dg-warning "-Waddress" } |
| 54 |
p++; |
| 55 |
if (&smi_def) // { dg-warning "-Waddress" } |
| 56 |
p++; |
| 57 |
|
| 58 |
if (&wsmi) |
| 59 |
p++; |
| 60 |
|
| 61 |
if (&wsmi_def) // { dg-warning "-Waddress" } |
| 62 |
p++; |
| 63 |
|
| 64 |
if (mia) // { dg-warning "-Waddress" } |
| 65 |
p++; |
| 66 |
if (smia) // { dg-warning "-Waddress" } |
| 67 |
p++; |
| 68 |
if (smia_def) // { dg-warning "-Waddress" } |
| 69 |
p++; |
| 70 |
|
| 71 |
if (wsmia) |
| 72 |
p++; |
| 73 |
|
| 74 |
if (wsmia_def) // { dg-warning "-Waddress" } |
| 75 |
p++; |
| 76 |
} |