diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/Wsequence-point-pr18050.C')
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wsequence-point-pr18050.C | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wsequence-point-pr18050.C b/gcc/testsuite/g++.dg/warn/Wsequence-point-pr18050.C new file mode 100644 index 000000000..63aecd0f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wsequence-point-pr18050.C @@ -0,0 +1,24 @@ +/* PR 18050 : bogus warning with -Wsequence-point */ +/* { dg-do compile } */ +/* { dg-options "-Wsequence-point" } */ + +struct x +{ + int i; +}; +void bar(struct x*, int *); + +void foo(struct x *y) +{ + bar(y++, &y->i); /* { dg-warning "operation on 'y' may be undefined" } */ +} + +void zz(int a, int *b) +{ + *b = a; +} + +void baz(void) { + int a = 5; + zz(++a, &a); /* { dg-bogus "operation on 'a' may be undefined" } */ +} |