[cfe-commits] r67726 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/SemaCXX/access.cpp
Anders Carlsson
andersca at mac.com
Wed Mar 25 18:24:28 PDT 2009
Author: andersca
Date: Wed Mar 25 20:24:28 2009
New Revision: 67726
URL: http://llvm.org/viewvc/llvm-project?rev=67726&view=rev
Log:
Set the access specifier for templates inside classes.
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/SemaCXX/access.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=67726&r1=67725&r2=67726&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Mar 25 20:24:28 2009
@@ -503,6 +503,9 @@
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);
Modified: cfe/trunk/test/SemaCXX/access.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/access.cpp?rev=67726&r1=67725&r2=67726&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/access.cpp (original)
+++ cfe/trunk/test/SemaCXX/access.cpp Wed Mar 25 20:24:28 2009
@@ -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 @@
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}}
+};
More information about the cfe-commits
mailing list