You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
6 # [...]
Similarly, the evaluation of a call to std::construct_at or std::ranges::construct_at ([specialized.construct]) does not disqualify E from being a core constant expression unless the first argument, of type T*, does not point to storage allocated with std::allocator or to an object whose lifetime began within the evaluation of E, or the evaluation of the underlying constructor call disqualifies E from being a core constant expression.
#include<memory>union num {
int i;
constexprnum() {
std::construct_at(&i); // the first argument does not point// to storage allocated with std::allocator<T> or// to an object whose lifetime began within the evaluation of E
}
};
static_assert(num{}.i == 0);
The text was updated successfully, but these errors were encountered:
Perhaps this issue should be reported in the CWG repo. I think expected (probably alongwith optional and variant after P2231R1) can't work without such allowance.
jwakely
changed the title
[expr.const] Disjunction disqualifies construct_from of non-active member
[expr.const] Disjunction disqualifies construct_at of non-active member
Oct 4, 2022
According to the wording, this code should be ill-formed, but implementations accept it: https://compiler-explorer.com/z/f8Tjx8EK5.
The text was updated successfully, but these errors were encountered: