[llvm-bugs] [Bug 48606] Clang rejects creation of struct with mutable member during constant evaluation
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 8 18:08:21 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=48606
Richard Smith <richard-llvm at metafoo.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
Fixed By Commit(s)| |21e8bb83253e1a2f4b6fad9b53c
| |afe8c530a38e2,
| |8153dee37272a73b1ed74ac1bc1
| |2422fac8ef033
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
Simpler testcase:
struct WithMutable {
mutable int val_{0};
};
constexpr void createOnHeap() {
WithMutable* var = new WithMutable{};
var->val_ = 1;
delete var;
}
Clang was not treating heap allocations as "lifetime started within the current
evaluation" for the purpose of determining whether 'mutable' prevents the
subobject from being used in the constant expression.
Fixed and backported to 12.0 release branch.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210209/9131147d/attachment.html>
More information about the llvm-bugs
mailing list