From: John McCall Date: Fri, 26 Aug 2011 18:42:59 +0000 (+0000) Subject: Assert that a call argument is a gl-value iff the parameter is a reference type. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8affed5107ea79bf4d429770d2873e9c7288255e;p=clang Assert that a call argument is a gl-value iff the parameter is a reference type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138639 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 846e1aa393..102793b48a 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -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);