Sign in
gnu
/
gcc
/
refs/heads/devel/c++-contracts
/
.
/
gcc
/
testsuite
/
g++.dg
/
cpp1y
/
constexpr-mutable1.C
blob: 6c47988c01a02ad5aa11f8356899641e18b9d6c1 [
file
] [
log
] [
blame
]
// PR c++/92505
// { dg-do compile { target c++14 } }
struct
S
{
mutable
int
m
;
};
static_assert
(
S
{
42
}.
m
==
42
,
""
);
constexpr
int
f
()
{
S s
=
{
40
};
s
.
m
++;
const
auto
&
cs
=
s
;
++
cs
.
m
;
return
cs
.
m
;
}
static_assert
(
f
()
==
42
,
""
);