Previously, clang rejected the following (copied from PR19741):
struct A { int a = 0; constexpr A() { a = 1; } }; constexpr bool f() { constexpr A a; static_assert(a.a == 1, ""); return a.a == 1; } static_assert(f(), "");
Clang didn't like the assignment to a in A() because it doesn't know that A is being constructed and therefore considers the subobject A.a to be const. The fix in this patch (which @rsmith suggested in the PR) is just to keep track of the set of objects that are currently being constructed, and strip away the const whenever we encounter a subobject of an object under construction.
https://bugs.llvm.org/show_bug.cgi?id=19741
Thanks for taking a look!
Erik