diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-const.C')
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-const.C | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-const.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-const.C new file mode 100644 index 000000000..7c079ad5c --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-const.C @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */ + +int foo(int* p) { + const int& q = *p; /* { dg-bogus "const vs. non-const" } */ + *p = 1; + return q; +} + |