forked from OSchip/llvm-project
Set the access specifier for templates inside classes.
llvm-svn: 67726
This commit is contained in:
parent
5558ca1d4f
commit
137108da15
|
@ -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);
|
||||
|
|
|
@ -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}}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue