1 /* Test messages for -Wtraditional-conversion, including that they are not
2    pedwarns.  */
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
4 /* { dg-do compile } */
5 /* { dg-options "-std=c99 -pedantic-errors -Wtraditional-conversion" } */
6 
7 void fsc(signed char);
8 void fsi(signed int);
9 void fsll(signed long long);
10 void fuc(unsigned char);
11 void fui(unsigned int);
12 void full(unsigned long long);
13 void ff(float);
14 void fld(long double);
15 void fcf(_Complex float);
16 
17 struct s {
18   void (*fsc)(signed char);
19   void (*fsi)(signed int);
20   void (*fsll)(signed long long);
21   void (*fuc)(unsigned char);
22   void (*fui)(unsigned int);
23   void (*full)(unsigned long long);
24   void (*ff)(float);
25   void (*fld)(long double);
26   void (*fcf)(_Complex float);
27 } x;
28 
29 signed char sc;
30 signed int si;
31 signed long long sll;
32 unsigned char uc;
33 unsigned int ui;
34 unsigned long long ull;
35 float f;
36 long double ld;
37 _Complex float cf;
38 
39 void
g(void)40 g (void)
41 {
42   fsi(f); /* { dg-warning "passing argument 1 of 'fsi' as integer rather than floating due to prototype" } */
43   x.fsi(f); /* { dg-warning "passing argument 1 of 'x.fsi' as integer rather than floating due to prototype" } */
44   fsi(cf); /* { dg-warning "passing argument 1 of 'fsi' as integer rather than complex due to prototype" } */
45   x.fsi(cf); /* { dg-warning "passing argument 1 of 'x.fsi' as integer rather than complex due to prototype" } */
46   fcf(f); /* { dg-warning "passing argument 1 of 'fcf' as complex rather than floating due to prototype" } */
47   x.fcf(f); /* { dg-warning "passing argument 1 of 'x.fcf' as complex rather than floating due to prototype" } */
48   fcf(si); /* { dg-warning "passing argument 1 of 'fcf' as complex rather than integer due to prototype" } */
49   x.fcf(si); /* { dg-warning "passing argument 1 of 'x.fcf' as complex rather than integer due to prototype" } */
50   ff(sc); /* { dg-warning "passing argument 1 of 'ff' as floating rather than integer due to prototype" } */
51   x.ff(sc); /* { dg-warning "passing argument 1 of 'x.ff' as floating rather than integer due to prototype" } */
52   ff(cf); /* { dg-warning "passing argument 1 of 'ff' as floating rather than complex due to prototype" } */
53   x.ff(cf); /* { dg-warning "passing argument 1 of 'x.ff' as floating rather than complex due to prototype" } */
54   ff(1.0); /* { dg-warning "passing argument 1 of 'ff' as 'float' rather than 'double' due to prototype" } */
55   x.ff(1.0); /* { dg-warning "passing argument 1 of 'x.ff' as 'float' rather than 'double' due to prototype" } */
56   fsll(sc); /* { dg-warning "passing argument 1 of 'fsll' with different width due to prototype" } */
57   x.fsll(sc); /* { dg-warning "passing argument 1 of 'x.fsll' with different width due to prototype" } */
58   fsc(sll); /* { dg-warning "passing argument 1 of 'fsc' with different width due to prototype" } */
59   x.fsc(sll); /* { dg-warning "passing argument 1 of 'x.fsc' with different width due to prototype" } */
60   fsi(ui); /* { dg-warning "passing argument 1 of 'fsi' as signed due to prototype" } */
61   x.fsi(ui); /* { dg-warning "passing argument 1 of 'x.fsi' as signed due to prototype" } */
62   full(sll); /* { dg-warning "passing argument 1 of 'full' as unsigned due to prototype" } */
63   x.full(sll); /* { dg-warning "passing argument 1 of 'x.full' as unsigned due to prototype" } */
64 }
65