diff options
-rw-r--r-- | gcc/cp/parser.cc | 3 | ||||
-rw-r--r-- | gcc/cp/pt.cc | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/partial-specialization14.C | 15 |
3 files changed, 17 insertions, 3 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 8ab98cc..fd614ba 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -35306,7 +35306,8 @@ static void cp_parser_check_access_in_redeclaration (tree decl, location_t location) { if (!decl - || (!CLASS_TYPE_P (TREE_TYPE (decl)) + || (!(CLASS_TYPE_P (TREE_TYPE (decl)) + && !CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (decl))) && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE)) return; diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 8d050e8..b611723 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -978,8 +978,6 @@ maybe_new_partial_specialization (tree& type) tree d = create_implicit_typedef (DECL_NAME (tmpl), t); DECL_CONTEXT (d) = TYPE_CONTEXT (t); DECL_SOURCE_LOCATION (d) = input_location; - TREE_PRIVATE (d) = (current_access_specifier == access_private_node); - TREE_PROTECTED (d) = (current_access_specifier == access_protected_node); TREE_PUBLIC (d) = TREE_PUBLIC (DECL_TEMPLATE_RESULT (tmpl)); set_instantiating_module (d); diff --git a/gcc/testsuite/g++.dg/template/partial-specialization14.C b/gcc/testsuite/g++.dg/template/partial-specialization14.C new file mode 100644 index 0000000..3780574 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/partial-specialization14.C @@ -0,0 +1,15 @@ +// Verify we don't care about the access specifier when declaring +// a partial specialization of a member class template. + +struct A1 { + template<class T> struct B { }; +private: + template<class T> struct B<T*> { }; // { dg-bogus "different access" } +}; + +struct A2 { + template<class T> struct B { }; + template<class T> struct B<T*>; +private: + template<class T> struct B<T*> { }; // { dg-bogus "different access" } +}; |