tree-optimization/116481 - avoid building function_type[]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / constexpr-mutable1.C
blob6c47988c01a02ad5aa11f8356899641e18b9d6c1
1 // PR c++/92505
2 // { dg-do compile { target c++14 } }
4 struct S { mutable int m; };
6 static_assert(S{42}.m == 42, "");
8 constexpr int f() {
9   S s = {40};
10   s.m++;
11   const auto& cs = s;
12   ++cs.m;
13   return cs.m;
16 static_assert(f() == 42, "");