Assert that a call argument is a gl-value iff the parameter is a reference type.

llvm-svn: 138639
This commit is contained in:
John McCall
2011-08-26 18:42:59 +00:00
parent 1cd60a2670
commit 0a76c0cf68

View File

@@ -1431,6 +1431,9 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E,
return emitWritebackArg(*this, args, CRE);
}
assert(type->isReferenceType() == E->isGLValue() &&
"reference binding to unmaterialized r-value!");
if (type->isReferenceType())
return args.add(EmitReferenceBindingToExpr(E, /*InitializedDecl=*/0),
type);