2018-05-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr13519-1.c
blob1117a0e16cddd723f9f40477a2a1a12c8f4d74e5
1 /* typeof applied to const+nonconst should be nonconst, as should
2 typeof applied to other arithmetic expressions. Bug 13519. */
3 /* Origin: Debian bug report 208981
4 from Kalle Olavi Niemitalo <kon@iki.fi>, adapted to a testcase by
5 Joseph Myers <jsm@polyomino.org.uk>. */
6 /* { dg-do compile } */
7 /* { dg-options "" } */
9 void fn(void)
11 int n;
12 const int c;
14 { __typeof__(n) a1; a1=0; }
15 { __typeof__(c) a2; a2=0; } /* { dg-error "read-only" "correct error" } */
16 { __typeof__((int)n) a3; a3=0; }
17 { __typeof__((int)c) a4; a4=0; } /* { dg-bogus "read-only" "bogus error" } */
18 { __typeof__((const int)n) a5; a5=0; }
19 { __typeof__((const int)c) a6; a6=0; }
20 { __typeof__(0) a7; a7=0; }
21 { __typeof__(1) a8; a8=0; }
23 { __typeof__(n+n) b0; b0=0; }
24 { __typeof__(n+c) b1; b1=0; }
25 { __typeof__(c+n) b2; b2=0; }
26 { __typeof__(c+c) b3; b3=0; }
28 { __typeof__(0+n) c0; c0=0; }
29 { __typeof__(0+c) c1; c1=0; }
30 { __typeof__(n+0) c2; c2=0; }
31 { __typeof__(c+0) c3; c3=0; }
33 { __typeof__(1+n) d0; d0=0; }
34 { __typeof__(1+c) d1; d1=0; }
35 { __typeof__(n+1) d2; d2=0; }
36 { __typeof__(c+1) d3; d3=0; }
38 { __typeof__(((int)n)+((int)n)) e0; e0=0; }
39 { __typeof__(((int)n)+((int)c)) e1; e1=0; }
40 { __typeof__(((int)c)+((int)n)) e2; e2=0; }
41 { __typeof__(((int)c)+((int)c)) e3; e3=0; }
43 { __typeof__(((const int)n)+((const int)n)) f0; f0=0; }
44 { __typeof__(((const int)n)+((const int)c)) f1; f1=0; }
45 { __typeof__(((const int)c)+((const int)n)) f2; f2=0; }
46 { __typeof__(((const int)c)+((const int)c)) f3; f3=0; }