/// - e->name
/// - *e, the type of e cannot be a function type
/// - string-constant
+/// - reference type [C++ [expr]]
///
Expr::isLvalueResult Expr::isLvalue() const {
// first, check the type (C99 6.3.2.1)
if (TR->isIncompleteType() && TR->isVoidType())
return LV_IncompleteVoidType;
-
+
+ if (isa<ReferenceType>(TR.getCanonicalType())) // C++ [expr]
+ return LV_Valid;
+
// the type looks fine, now check the expression
switch (getStmtClass()) {
case StringLiteralClass: // C99 6.5.1p4
void Sema::DefaultFunctionArrayConversion(Expr *&e) {
QualType t = e->getType();
assert(!t.isNull() && "DefaultFunctionArrayConversion - missing type");
-
+
+ if (const ReferenceType *ref = dyn_cast<ReferenceType>(t.getCanonicalType()))
+ t = promoteExprToType(e, ref->getReferenceeType()); // C++ [expr]
if (t->isFunctionType())
promoteExprToType(e, Context.getPointerType(t));
else if (const ArrayType *ary = dyn_cast<ArrayType>(t.getCanonicalType()))
QualType t = expr->getType();
assert(!t.isNull() && "UsualUnaryConversions - missing type");
+ if (const ReferenceType *ref = dyn_cast<ReferenceType>(t.getCanonicalType()))
+ t = promoteExprToType(expr, ref->getReferenceeType()); // C++ [expr]
if (t->isPromotableIntegerType()) // C99 6.3.1.1p2
promoteExprToType(expr, Context.IntTy);
else