[PATCH] D147621: [clang][Interp] Start handling mutable record members
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 2 09:20:40 PDT 2023
shafik added a comment.
Two cases to consider: https://godbolt.org/z/ovofPExGK
namespace MutableFields {
class Foo {
public:
constexpr Foo() : I(1) {}
mutable int I; // ref-note {{declared here}}
};
constexpr int foo() {
constexpr Foo F;
F.I = 12;
return F.I;
}
static_assert(foo() == 12, "");
}
clang and gcc disagree on this one, I think clang is right not 100%.
and this one:
namespace MutableFields {
class Foo {
public:
constexpr Foo() : I(1) {}
mutable int I; // ref-note {{declared here}}
};
constexpr int foo() {
constexpr Foo F; // A
F.I = 12;
constexpr int x = F.I; // B
return F.I;
}
static_assert(foo() == 12, "");
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147621/new/
https://reviews.llvm.org/D147621
More information about the cfe-commits
mailing list