Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/constexpr-tracking-const15.C

raw
1 // PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
2 // { dg-do compile { target c++14 } }
3
4 constexpr int& impl(const int (&array)[10], int index) {
5 return const_cast<int&>(array[index]);
6 }
7
8 struct A {
9 constexpr int& operator[](int i) { return impl(elems, i); }
10 int elems[10];
11 };
12
13 constexpr bool
14 f()
15 {
16 A arr = {};
17 arr[2] = true;
18 return false;
19 }
20
21 constexpr bool b = f();