initialization of references should not do default fn/array promotions.
This fixes a bug Anders noticed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43024 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 8ee0913..046b92b 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -1056,11 +1056,15 @@
Sema::AssignmentCheckResult
Sema::CheckSingleAssignmentConstraints(QualType lhsType, Expr *&rExpr) {
- // This check seems unnatural, however it is necessary to insure the proper
+ // This check seems unnatural, however it is necessary to ensure the proper
// conversion of functions/arrays. If the conversion were done for all
// DeclExpr's (created by ActOnIdentifierExpr), it would mess up the unary
// expressions that surpress this implicit conversion (&, sizeof).
- DefaultFunctionArrayConversion(rExpr);
+ //
+ // Suppress this for references: C99 8.5.3p5. FIXME: revisit when references
+ // are better understood.
+ if (!lhsType->isReferenceType())
+ DefaultFunctionArrayConversion(rExpr);
Sema::AssignmentCheckResult result;