diff options
Diffstat (limited to 'validation/eval/union-cast-no.c')
-rw-r--r-- | validation/eval/union-cast-no.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/validation/eval/union-cast-no.c b/validation/eval/union-cast-no.c new file mode 100644 index 00000000..d06b348d --- /dev/null +++ b/validation/eval/union-cast-no.c @@ -0,0 +1,24 @@ +union u { + int i; + char x[8]; +}; + +static union u foo(int i) +{ + return (union u)i; +} + +static union u bar(long l) +{ + return (union u)l; +} + +/* + * check-name: union-cast-no + * check-command: sparse -Wno-union-cast $file + * check-known-to-fail + * + * check-error-start +eval/union-cast-no.c:13:17: warning: cast to non-scalar + * check-error-end + */ |