aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/ExprClassification.cpp7
-rw-r--r--clang/lib/Sema/SemaExpr.cpp2
-rw-r--r--clang/test/SemaCXX/MicrosoftExtensions.cpp12
3 files changed, 18 insertions, 3 deletions
diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp
index 933ea97..124b467 100644
--- a/clang/lib/AST/ExprClassification.cpp
+++ b/clang/lib/AST/ExprClassification.cpp
@@ -418,9 +418,10 @@ static Cl::Kinds ClassifyDecl(ASTContext &Ctx, const Decl *D) {
islvalue = NTTParm->getType()->isReferenceType();
else
islvalue = isa<VarDecl>(D) || isa<FieldDecl>(D) ||
- isa<IndirectFieldDecl>(D) ||
- (Ctx.getLangOpts().CPlusPlus &&
- (isa<FunctionDecl>(D) || isa<FunctionTemplateDecl>(D)));
+ isa<IndirectFieldDecl>(D) ||
+ (Ctx.getLangOpts().CPlusPlus &&
+ (isa<FunctionDecl>(D) || isa<MSPropertyDecl>(D) ||
+ isa<FunctionTemplateDecl>(D)));
return islvalue ? Cl::CL_LValue : Cl::CL_PRValue;
}
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 4b807c1..90f5046 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -9352,6 +9352,8 @@ QualType Sema::CheckAddressOfOperand(ExprResult &OrigOp, SourceLocation OpLoc) {
!getLangOpts().CPlusPlus) {
AddressOfError = AO_Register_Variable;
}
+ } else if (isa<MSPropertyDecl>(dcl)) {
+ AddressOfError = AO_Property_Expansion;
} else if (isa<FunctionTemplateDecl>(dcl)) {
return Context.OverloadTy;
} else if (isa<FieldDecl>(dcl) || isa<IndirectFieldDecl>(dcl)) {
diff --git a/clang/test/SemaCXX/MicrosoftExtensions.cpp b/clang/test/SemaCXX/MicrosoftExtensions.cpp
index 57d6f0d..db5e458 100644
--- a/clang/test/SemaCXX/MicrosoftExtensions.cpp
+++ b/clang/test/SemaCXX/MicrosoftExtensions.cpp
@@ -344,6 +344,18 @@ struct StructWithUnnamedMember {
__declspec(property(get=GetV)) int : 10; // expected-error {{anonymous property is not supported}}
};
+struct MSPropertyClass {
+ int get() { return 42; }
+ int __declspec(property(get = get)) n;
+};
+
+int *f(MSPropertyClass &x) {
+ return &x.n; // expected-error {{address of property expression requested}}
+}
+int MSPropertyClass::*g() {
+ return &MSPropertyClass::n; // expected-error {{address of property expression requested}}
+}
+
namespace rdar14250378 {
class Bar {};