We're in a constant context in the ConstantEmitter.

llvm-svn: 348029
This commit is contained in:
Bill Wendling 2018-11-30 20:40:06 +00:00
parent 601d311326
commit e64fe2abae
2 changed files with 13 additions and 1 deletions

View File

@ -1552,7 +1552,8 @@ llvm::Constant *ConstantEmitter::tryEmitPrivate(const Expr *E,
if (destType->isReferenceType())
Success = E->EvaluateAsLValue(Result, CGM.getContext());
else
Success = E->EvaluateAsRValue(Result, CGM.getContext());
Success = E->EvaluateAsRValue(Result, CGM.getContext(),
/* InConstantContext */ true);
llvm::Constant *C;
if (Success && !Result.HasSideEffects)

View File

@ -157,3 +157,14 @@ static void src_fn(void) {
void test14() {
assign(dest_p, src_fn);
}
struct test15_s {
const char *name;
int num_args;
};
extern int test15_v;
struct test15_s tcg_op_defs_org_x86_64[] = {
{"tag", __builtin_constant_p(test15_v) && !test15_v ? 0x10 : 0 },
};