aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-const.C
blob: 7c079ad5c54834ca967478975656c540c1a88e27 (plain)
1
2
3
4
5
6
7
8
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;
}