diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-05-17 16:05:15 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-11-13 14:16:51 +0100 |
| commit | 1dfaa8e70adbaa420b8ad08311dfb05265b98c6a (patch) | |
| tree | 09949fc60d57530fb19af61a801c5889131f5036 /validation | |
| parent | 4a51733e789de3c073e7be51f4bdb52cc66513d9 (diff) | |
| download | sparse-dev-1dfaa8e70adbaa420b8ad08311dfb05265b98c6a.tar.gz | |
add test case for compound literals
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/compound-literal00.c | 18 | ||||
| -rw-r--r-- | validation/compound-literal01.c | 27 |
2 files changed, 45 insertions, 0 deletions
diff --git a/validation/compound-literal00.c b/validation/compound-literal00.c new file mode 100644 index 00000000..f3069d2c --- /dev/null +++ b/validation/compound-literal00.c @@ -0,0 +1,18 @@ +struct bfs { + int a: 2; + int b: 30; +}; + +int foo(void) +{ + return (struct bfs){ .a = 1, .b = 2}.b; +} + +/* + * check-name: compound-literal00.c + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-contains: ret\\..*\\$2 + * check-error-end + */ diff --git a/validation/compound-literal01.c b/validation/compound-literal01.c new file mode 100644 index 00000000..8a4935ea --- /dev/null +++ b/validation/compound-literal01.c @@ -0,0 +1,27 @@ +struct bfs { + int a: 2; + int b: 30; +}; + +int foo(void) +{ + struct bfs bf = { .a = 1, .b = 2 }; + return (struct bfs[]){bf}[0].b; +} + +int bar(void) +{ + struct bfs bf = { .a = 1, .b = 4 }; + return (struct bfs[]){bf, { .a = 3, .b = 6}}[1].b; +} + +/* + * check-name: compound-literal01.c + * check-command: test-linearize -Wno-decl $file + * + * check-known-to-fail + * check-output-ignore + * check-output-contains: ret\\..*\\$2 + * check-output-contains: ret\\..*\\$6 + * check-error-end + */ |
