[Bug c++/79520] New: Spurious caching for constexpr arguments
columbo@gmx-topmail.de
gcc-bugzilla@gcc.gnu.org
Tue Feb 14 23:06:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79520
Bug ID: 79520
Summary: Spurious caching for constexpr arguments
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: columbo@gmx-topmail.de
Target Milestone: ---
constexpr int f(int const& x) {return x;}
constexpr struct S {
int x = 0;
constexpr S() {(void)f(x); x = 1;}
} s;
static_assert(f(s.x) == 1, "");
---
Presumably s.x is taken to be "immutable" because s is constexpr, while that's
obviously not true during the period of construction.
More information about the Gcc-bugs
mailing list