forked from OSchip/llvm-project
initialization of references should not do default fn/array promotions.
This fixes a bug Anders noticed. llvm-svn: 43024
This commit is contained in:
parent
698495522d
commit
e6dcd505d0
|
@ -1056,11 +1056,15 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) {
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
// RUN: clang -fsyntax-only %s
|
||||
int g(int);
|
||||
|
||||
#if 0
|
||||
void f() {
|
||||
int i;
|
||||
int &r = i;
|
||||
r = 1;
|
||||
#if 0 // FIXME: &ref not right yet
|
||||
int *p = &r;
|
||||
#endif
|
||||
int &rr = r;
|
||||
int (&rg)(int) = g;
|
||||
rg(i);
|
||||
|
@ -18,4 +19,12 @@ void f() {
|
|||
P[1] = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
typedef int t[1];
|
||||
void test2() {
|
||||
t a;
|
||||
t& b = a;
|
||||
|
||||
|
||||
int c[3];
|
||||
int (&rc)[3] = c;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue