aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-03-26 01:24:28 +0000
committerAnders Carlsson <andersca@mac.com>2009-03-26 01:24:28 +0000
commit4cbe82c7c82ca0106f60296a60951d41f7d2ec7d (patch)
tree8f7ca897f0c9354d06f4a83e06a675268aa0c164
parent0cf8830a45115176ef5ba5416b7ad7aa9d5cb255 (diff)
Set the access specifier for templates inside classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67726 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaTemplate.cpp3
-rw-r--r--test/SemaCXX/access.cpp12
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index b8b1f3a5bb..697582c82c 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -503,6 +503,9 @@ Sema::ActOnClassTemplate(Scope *S, unsigned TagSpec, TagKind TK,
NewClass, PrevClassTemplate);
NewClass->setDescribedClassTemplate(NewTemplate);
+ // Set the access specifier.
+ SetMemberAccessSpecifier(NewTemplate, PrevClassTemplate, AS);
+
// Set the lexical context of these templates
NewClass->setLexicalDeclContext(CurContext);
NewTemplate->setLexicalDeclContext(CurContext);
diff --git a/test/SemaCXX/access.cpp b/test/SemaCXX/access.cpp
index d95781c1b7..cfbc9c8069 100644
--- a/test/SemaCXX/access.cpp
+++ b/test/SemaCXX/access.cpp
@@ -2,8 +2,8 @@
class C {
struct S; // expected-note {{previously declared 'private' here}}
-
public:
+
struct S {}; // expected-error {{'S' redeclared with 'public' access}}
};
@@ -12,4 +12,12 @@ struct S {
private:
class C { }; // expected-error {{'C' redeclared with 'private' access}}
-}; \ No newline at end of file
+};
+
+class T {
+protected:
+ template<typename T> struct A; // expected-note {{previously declared 'protected' here}}
+
+private:
+ template<typename T> struct A {}; // expected-error {{'A' redeclared with 'private' access}}
+};