summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/Sema/Sema.h2
-rw-r--r--clang/lib/Sema/SemaAccess.cpp8
-rw-r--r--clang/lib/Sema/SemaLookup.cpp2
-rw-r--r--clang/test/SemaCXX/typo-correction-pt2.cpp9
4 files changed, 14 insertions, 7 deletions
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 116b427266e..378245585ab 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -4896,7 +4896,7 @@ public:
AccessResult CheckFriendAccess(NamedDecl *D);
AccessResult CheckMemberAccess(SourceLocation UseLoc,
CXXRecordDecl *NamingClass,
- NamedDecl *D);
+ DeclAccessPair Found);
AccessResult CheckMemberOperatorAccess(SourceLocation Loc,
Expr *ObjectExpr,
Expr *ArgExpr,
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp
index 6dbfad4e18d..974f3b42db1 100644
--- a/clang/lib/Sema/SemaAccess.cpp
+++ b/clang/lib/Sema/SemaAccess.cpp
@@ -1390,8 +1390,6 @@ static AccessResult IsAccessible(Sema &S,
CXXBasePath *Path = FindBestPath(S, EC, Entity, FinalAccess, Paths);
if (!Path)
return AR_dependent;
- if (Path->Access == AS_none) // This can happen during typo correction.
- return AR_inaccessible;
assert(Path->Access <= UnprivilegedAccess &&
"access along best path worse than direct?");
@@ -1716,14 +1714,14 @@ Sema::AccessResult Sema::CheckAllocationAccess(SourceLocation OpLoc,
/// \brief Checks access to a member.
Sema::AccessResult Sema::CheckMemberAccess(SourceLocation UseLoc,
CXXRecordDecl *NamingClass,
- NamedDecl *D) {
+ DeclAccessPair Found) {
if (!getLangOpts().AccessControl ||
!NamingClass ||
- D->getAccess() == AS_public)
+ Found.getAccess() == AS_public)
return AR_accessible;
AccessTarget Entity(Context, AccessTarget::Member, NamingClass,
- DeclAccessPair::make(D, D->getAccess()), QualType());
+ Found, QualType());
return CheckAccess(*this, UseLoc, Entity);
}
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index c2e23c7ede4..2a096cfd978 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -4409,7 +4409,7 @@ retry_lookup:
TRD != TRDEnd; ++TRD) {
if (CheckMemberAccess(TC.getCorrectionRange().getBegin(),
NSType ? NSType->getAsCXXRecordDecl() : 0,
- *TRD) == AR_accessible)
+ TRD.getPair()) == AR_accessible)
TC.addCorrectionDecl(*TRD);
}
if (TC.isResolved())
diff --git a/clang/test/SemaCXX/typo-correction-pt2.cpp b/clang/test/SemaCXX/typo-correction-pt2.cpp
index 1ccd103ecff..9c7fb14ccfd 100644
--- a/clang/test/SemaCXX/typo-correction-pt2.cpp
+++ b/clang/test/SemaCXX/typo-correction-pt2.cpp
@@ -135,3 +135,12 @@ void test() {
req.set_check(false); // expected-error-re {{use of undeclared identifier 'req'$}}
}
}
+
+namespace PR17394 {
+ class A {
+ protected:
+ long zzzzzzzzzz;
+ };
+ class B : private A {};
+ B zzzzzzzzzy<>; // expected-error {{expected ';' after top level declarator}}{}
+}
OpenPOWER on IntegriCloud