File: cond_expr.c

package info (click to toggle)
sparse 0.4.1%2Bgit20081218-1
  • links: PTS, VCS
  • area: non-free
  • in suites: squeeze
  • size: 1,348 kB
  • ctags: 2,852
  • sloc: ansic: 25,201; perl: 236; makefile: 181; sh: 181
file content (19 lines) | stat: -rw-r--r-- 492 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 *  Bug in original tree: (real_v ? : x) had been treated as equivalent of
 *  (real_v == 0 ? real_v == 0 : x), which gives the wrong type (and no
 *  warning from the testcase below).
 */
static int x;
static double y;
int a(void)
{
	return ~(y ? : x);	/* should warn */
}
/*
 * check-name: Two-argument conditional expression types
 *
 * check-error-start
cond_expr.c:10:9: error: incompatible types for operation (~)
cond_expr.c:10:9:    argument has type double
 * check-error-end
 */