The paper never mentions how reloc and constexpr work together. Namely:
- can
reloc be used in a constexpr?
- can the relocation constructor be
constexpr?
- can the relocation assign operator be
constexpr?
- can a decomposing function be
constexpr?
The only thing that gets me slightly worried is the eliding ABI trick. On caller-destroy ABI, we propose to emit two functions (eliding and classic) for the reloc assign operator and decomposing functions.
The classic function is caller-destroy and will call the eliding one which is callee-destroy, using the following trick:
f.classic(T value)
{
union { T __tmp } = { .__tmp = reloc value /* move or copy construct */ };
f.eliding(&__tmp);
}
I don't know to what extent the union trick is compliant w/t constexpr, nor if it even matters as this is part of compiler-generated code.
Also, in the case of a trivially relocatable type, reloc x will likely get optimized into a single memcpy call. This paper legalizes this optimization, but I believe we must clearly write it down in the context of constexpr.
Do you foresee any other issues? What's your take on this?
The paper never mentions how
relocandconstexprwork together. Namely:relocbe used in aconstexpr?constexpr?constexpr?constexpr?The only thing that gets me slightly worried is the eliding ABI trick. On caller-destroy ABI, we propose to emit two functions (eliding and classic) for the reloc assign operator and decomposing functions.
The classic function is caller-destroy and will call the eliding one which is callee-destroy, using the following trick:
f.classic(T value) { union { T __tmp } = { .__tmp = reloc value /* move or copy construct */ }; f.eliding(&__tmp); }I don't know to what extent the union trick is compliant w/t
constexpr, nor if it even matters as this is part of compiler-generated code.Also, in the case of a trivially relocatable type,
reloc xwill likely get optimized into a singlememcpycall. This paper legalizes this optimization, but I believe we must clearly write it down in the context ofconstexpr.Do you foresee any other issues? What's your take on this?