blob: e9e2992d0a2c95a9ecd881ba886040e1c444afb6 [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001// RUN: clang -parse-ast-check %s
2
3int foo(int X, int Y);
4
5void bar(volatile int *VP, int *P, int A,
6 _Complex double C, volatile _Complex double VC) {
7
Steve Naroff77878cc2007-08-27 04:08:11 +00008 VP == P; // expected-warning {{expression result unused}}
Chris Lattner6e844ad2007-08-26 17:32:59 +00009 (void)A;
Reid Spencer5f016e22007-07-11 17:01:13 +000010 (void)foo(1,2); // no warning.
11
12 A == foo(1, 2); // expected-warning {{expression result unused}}
13
14 foo(1,2)+foo(4,3); // expected-warning {{expression result unused}}
15
16
17 *P; // expected-warning {{expression result unused}}
18 *VP; // no warning.
19 P[4]; // expected-warning {{expression result unused}}
20 VP[4]; // no warning.
21
22 // FIXME: SEMA explodes on these.
23 //__real__ C;
24 //__real__ VC;
25}
26
Chris Lattner6e844ad2007-08-26 17:32:59 +000027extern void t1();
28extern void t2();
29void t3(int c) {
30 c ? t1() : t2();
31}
32
Chris Lattner98414c12007-08-31 21:49:55 +000033// This shouldn't warn: the expr at the end of the stmtexpr really is used.
34int stmt_expr(int x, int y) {
35 return ({int _a = x, _b = y; _a > _b ? _a : _b; });
36}
37