Set the access specifier for templates inside classes.

llvm-svn: 67726
This commit is contained in:
Anders Carlsson 2009-03-26 01:24:28 +00:00
parent 5558ca1d4f
commit 137108da15
2 changed files with 13 additions and 2 deletions

View File

@ -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);

View File

@ -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}}
};
};
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}}
};