summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaAccess.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-04-29 10:13:55 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-04-29 10:13:55 +0000
commitad5c1ca44d01a40a8c9a079b33dbaa623515dece (patch)
tree639714ec66265127ec196decc42647c0172320d4 /clang/lib/Sema/SemaAccess.cpp
parent7cd81c55c7b4fff4a4c10e71a1ef2cf5e7f3bbd1 (diff)
downloadbcm5719-llvm-ad5c1ca44d01a40a8c9a079b33dbaa623515dece.tar.gz
bcm5719-llvm-ad5c1ca44d01a40a8c9a079b33dbaa623515dece.zip
Implement DR580: access checks for template parameters of a class template are
performed within the context of that class template. Patch by Ismail Pazarbasi! llvm-svn: 180707
Diffstat (limited to 'clang/lib/Sema/SemaAccess.cpp')
-rw-r--r--clang/lib/Sema/SemaAccess.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp
index 79a9d3c9fdc..3ef1fdebaac 100644
--- a/clang/lib/Sema/SemaAccess.cpp
+++ b/clang/lib/Sema/SemaAccess.cpp
@@ -84,10 +84,10 @@ struct EffectiveContext {
: Inner(DC),
Dependent(DC->isDependentContext()) {
- // C++ [class.access.nest]p1:
+ // C++11 [class.access.nest]p1:
// A nested class is a member and as such has the same access
// rights as any other member.
- // C++ [class.access]p2:
+ // C++11 [class.access]p2:
// A member of a class can also access all the names to which
// the class has access. A local class of a member function
// may access the same names that the member function itself
@@ -1476,18 +1476,18 @@ static Sema::AccessResult CheckAccess(Sema &S, SourceLocation Loc,
llvm_unreachable("falling off end");
}
-void Sema::HandleDelayedAccessCheck(DelayedDiagnostic &DD, Decl *decl) {
+void Sema::HandleDelayedAccessCheck(DelayedDiagnostic &DD, Decl *D) {
// Access control for names used in the declarations of functions
// and function templates should normally be evaluated in the context
// of the declaration, just in case it's a friend of something.
// However, this does not apply to local extern declarations.
- DeclContext *DC = decl->getDeclContext();
- if (FunctionDecl *fn = dyn_cast<FunctionDecl>(decl)) {
- if (!DC->isFunctionOrMethod()) DC = fn;
- } else if (FunctionTemplateDecl *fnt = dyn_cast<FunctionTemplateDecl>(decl)) {
- // Never a local declaration.
- DC = fnt->getTemplatedDecl();
+ DeclContext *DC = D->getDeclContext();
+ if (FunctionDecl *FN = dyn_cast<FunctionDecl>(D)) {
+ if (!DC->isFunctionOrMethod())
+ DC = FN;
+ } else if (TemplateDecl *TD = dyn_cast<TemplateDecl>(D)) {
+ DC = cast<DeclContext>(TD->getTemplatedDecl());
}
EffectiveContext EC(DC);
OpenPOWER on IntegriCloud