From f67129ab204e2884d674075d74e8ffe1f17f67e3 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 19 Jun 2013 16:37:23 +0000 Subject: [PATCH] [Windows] Fix __declspec(property) when the getter returns a ref This fixes an issue when parsing atlbase.h. Patch by Will Wilson! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184319 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaExpr.cpp | 3 ++- test/SemaCXX/MicrosoftExtensions.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index edeb731b83..56ece247c6 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -2003,7 +2003,8 @@ ExprResult Sema::ActOnIdExpression(Scope *S, MightBeImplicitMember = true; else MightBeImplicitMember = isa(R.getFoundDecl()) || - isa(R.getFoundDecl()); + isa(R.getFoundDecl()) || + isa(R.getFoundDecl()); if (MightBeImplicitMember) return BuildPossibleImplicitMemberExpr(SS, TemplateKWLoc, diff --git a/test/SemaCXX/MicrosoftExtensions.cpp b/test/SemaCXX/MicrosoftExtensions.cpp index c0e7a5ad4c..217fc6e6d7 100644 --- a/test/SemaCXX/MicrosoftExtensions.cpp +++ b/test/SemaCXX/MicrosoftExtensions.cpp @@ -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); +} -- 2.40.0