Change dyn_cast for reference types to be more like pointers and not need the canonical type. Also fix so that we're not expecting a return value from a void function
llvm-svn: 39954
diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp
index 93a2df9..952c83f 100644
--- a/clang/Sema/SemaExpr.cpp
+++ b/clang/Sema/SemaExpr.cpp
@@ -597,8 +597,10 @@
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 (const ReferenceType *ref = dyn_cast<ReferenceType>(t)) {
+ promoteExprToType(e, ref->getReferenceeType()); // C++ [expr]
+ t = e->getType();
+ }
if (t->isFunctionType())
promoteExprToType(e, Context.getPointerType(t));
else if (const ArrayType *ary = dyn_cast<ArrayType>(t.getCanonicalType()))
@@ -614,8 +616,10 @@
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 (const ReferenceType *ref = dyn_cast<ReferenceType>(t)) {
+ promoteExprToType(expr, ref->getReferenceeType()); // C++ [expr]
+ t = expr->getType();
+ }
if (t->isPromotableIntegerType()) // C99 6.3.1.1p2
promoteExprToType(expr, Context.IntTy);
else