2 // { dg-do compile { target c++14 } }
7 r = 99; // { dg-error "modifying a const object" }
13 const int i = 0; // { dg-message "originally declared" }
14 mod (const_cast<int &>(i)); // { dg-message "in .constexpr. expansion of " }
18 constexpr int i1 = fn1 (); // { dg-message "in .constexpr. expansion of " }
23 const int i = 5; // { dg-message "originally declared" }
24 const_cast<int &>(i) = 10; // { dg-error "modifying a const object" }
28 constexpr int i2 = fn2 (); // { dg-message "in .constexpr. expansion of " }
33 const int i = 5; // { dg-message "originally declared" }
34 ++const_cast<int &>(i); // { dg-error "modifying a const object" }
38 constexpr int i3 = fn3 (); // { dg-message "in .constexpr. expansion of " }
43 const int i = 5; // { dg-message "originally declared" }
44 const_cast<int &>(i)--; // { dg-error "modifying a const object" }
48 constexpr int i4 = fn4 (); // { dg-message "in .constexpr. expansion of " }
53 const int i = 5; // { dg-message "originally declared" }
54 const_cast<int &>(i) += 2; // { dg-error "modifying a const object" }
58 constexpr int i5 = fn5 (); // { dg-message "in .constexpr. expansion of " }
66 int *ip = const_cast<int *>(cip);
71 constexpr int i6 = fn6 ();
72 static_assert(i6 == 4, "");