[LLVMdev] Evaluation of offsetof() macro

Joerg Sonnenberger joerg at britannica.bec.de
Sat Jan 3 13:23:30 PST 2015


On Fri, Jan 02, 2015 at 05:26:42PM -0800, Vadim Chugunov wrote:
> My goal is to be able to use the result in constexpr contexts (like
> declaring an array, whose size expression involves offsetof()).   Please
> correct me if this is wrong, but I think this means that the expression
> must be evaluated before any IR is emitted.

Do you start from offsetof() or the expanded form? For various reasons,
it is normally defined to use __builtin_offsetof, since the problems you
have run into also stop the "legacy" C version from being appropoiate
for C++ as it doesn't create an ICE.

Joerg



More information about the llvm-dev mailing list