<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><div><br></div></span><div> So it handles all const expression evaluation in the front-end?  <br><br></div></div></div></div>
</blockquote></div><br></div></div></div><div class="gmail_extra">Yes, clang has it's own constant expression evaluator which understands the rules of C++.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Let's take an example.</div><div class="gmail_extra">The expression (long)&x/(long)&y divides two globals by each other.  This expression is lowered to the following LLVM IR Constant:</div><div class="gmail_extra">i64 sdiv (i64 ptrtoint (i32* @x to i64), i64 ptrtoint (i32* @y to i64))<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">This Constant is a ConstantExpr but certainly not indicative of something that would be 'constexpr' in C++.</div></div>
</blockquote></div><br>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.</div><div class="gmail_extra"><br></div></div>