Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/constexpr-mutable1.C

raw
1 // PR c++/92505
2 // { dg-do compile { target c++14 } }
3
4 struct S { mutable int m; };
5
6 static_assert(S{42}.m == 42, "");
7
8 constexpr int f() {
9 S s = {40};
10 s.m++;
11 const auto& cs = s;
12 ++cs.m;
13 return cs.m;
14 }
15
16 static_assert(f() == 42, "");