[cfe-commits] r72150 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGenCXX/references.cpp

Eli Friedman eli.friedman at gmail.com
Tue May 19 17:58:57 PDT 2009


On Tue, May 19, 2009 at 5:36 PM, Anders Carlsson <andersca at mac.com> wrote:
>  RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E,
>                                                    QualType DestType) {
> +  if (E->isLvalue(getContext()) == Expr::LV_Valid) {
> +    // Emit the expr as an lvalue.
> +    LValue LV = EmitLValue(E);
> +    return RValue::get(LV.getAddress());
> +  }

That check isn't quite right; take the following testcase:

int b(const int&);
int a() {
  struct x {int x : 3; } y = {3};
  return b(y.x);
}

-Eli




More information about the cfe-commits mailing list