]> granicus.if.org Git - clang/commitdiff
Assert that a call argument is a gl-value iff the parameter is a reference type.
authorJohn McCall <rjmccall@apple.com>
Fri, 26 Aug 2011 18:42:59 +0000 (18:42 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 26 Aug 2011 18:42:59 +0000 (18:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138639 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCall.cpp

index 846e1aa3934d26ffe42aefa37d6ea36efb6d6a8b..102793b48ab8f44966c0f568b826df990fab45da 100644 (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);