[Windows] Fix __declspec(property) when the getter returns a ref

This fixes an issue when parsing atlbase.h.

Patch by Will Wilson!

llvm-svn: 184319
This commit is contained in:
Reid Kleckner 2013-06-19 16:37:23 +00:00
parent b5375cd1b6
commit 0a0c8895ea
2 changed files with 19 additions and 1 deletions

View File

@ -2003,7 +2003,8 @@ ExprResult Sema::ActOnIdExpression(Scope *S,
MightBeImplicitMember = true;
else
MightBeImplicitMember = isa<FieldDecl>(R.getFoundDecl()) ||
isa<IndirectFieldDecl>(R.getFoundDecl());
isa<IndirectFieldDecl>(R.getFoundDecl()) ||
isa<MSPropertyDecl>(R.getFoundDecl());
if (MightBeImplicitMember)
return BuildPossibleImplicitMemberExpr(SS, TemplateKWLoc,

View File

@ -344,3 +344,20 @@ union u {
int *i1;
int &i2; // expected-warning {{union member 'i2' has reference type 'int &', which is a Microsoft extension}}
};
// Property getter using reference.
struct SP11 {
__declspec(property(get=GetV)) int V;
int _v;
int& GetV() { return _v; }
void UseV();
void TakePtr(int *) {}
void TakeRef(int &) {}
void TakeVal(int) {}
};
void SP11::UseV() {
TakePtr(&V);
TakeRef(V);
TakeVal(V);
}