c++, coroutines: Simplify separation of the user function body and ramp.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / constexpr-tracking-const15.C
blobdb1b2bb7ea675ed5cc4da01027228d640d0c00b6
1 // PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
2 // { dg-do compile { target c++14 } }
4 constexpr int& impl(const int (&array)[10], int index) {
5   return const_cast<int&>(array[index]);
8 struct A {
9   constexpr int& operator[](int i) { return impl(elems, i); }
10   int elems[10];
13 constexpr bool
14 f()
16   A arr = {};
17   arr[2] = true;
18   return false;
21 constexpr bool b = f();