From ba1e69c03f96f8f9f0e0d4218b168bf975a83cbb Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 13 Nov 2016 01:51:23 -0500 Subject: [PATCH] DR 374 - specialization in outer namespace PR c++/56840 * pt.c (check_specialization_namespace): Allow any enclosing namespace. (check_unqualified_spec_or_inst): New. (check_explicit_specialization): Call it. * parser.c (cp_parser_elaborated_type_specifier) (cp_parser_class_head): Call it. From-SVN: r242348 --- gcc/cp/ChangeLog | 11 +++ gcc/cp/cp-tree.h | 1 + gcc/cp/decl.c | 3 +- gcc/cp/name-lookup.c | 2 +- gcc/cp/parser.c | 37 +++++++--- gcc/cp/pt.c | 67 +++++++++++++------ gcc/testsuite/g++.dg/cpp0x/explicit-inst1.C | 13 ++++ gcc/testsuite/g++.dg/template/spec17.C | 2 +- gcc/testsuite/g++.dg/template/spec25.C | 4 +- gcc/testsuite/g++.dg/template/spec36.C | 4 +- .../g++.old-deja/g++.ns/template13.C | 4 +- .../g++.old-deja/g++.pt/explicit73.C | 2 +- gcc/testsuite/g++.old-deja/g++.pt/lookup10.C | 4 +- .../requirements/explicit_instantiation.cc | 11 ++- .../requirements/explicit_instantiation.cc | 11 ++- .../requirements/explicit_instantiation.cc | 11 ++- .../requirements/explicit_instantiation.cc | 11 ++- .../ext/numeric_traits/numeric_traits.cc | 7 +- .../requirements/explicit_instantiation/1.cc | 9 ++- .../requirements/explicit_instantiation/1.cc | 9 ++- .../requirements/explicit_instantiation/2.cc | 7 +- .../requirements/explicit_instantiation/1.cc | 9 ++- .../requirements/explicit_instantiation/2.cc | 9 ++- .../requirements/explicit_instantiation.cc | 36 +++++----- .../requirements/explicit_instantiation.cc | 8 +-- .../requirements/explicit_instantiation.cc | 8 +-- .../requirements/explicit_instantiation.cc | 8 +-- .../requirements/explicit_instantiation.cc | 14 ++-- 28 files changed, 190 insertions(+), 132 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/explicit-inst1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 678c44d5d40..60186ee9fb8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2016-11-12 Jason Merrill + + DR 374 + PR c++/56840 + * pt.c (check_specialization_namespace): Allow any enclosing + namespace. + (check_unqualified_spec_or_inst): New. + (check_explicit_specialization): Call it. + * parser.c (cp_parser_elaborated_type_specifier) + (cp_parser_class_head): Call it. + 2016-11-10 Jason Merrill PR c++/77337 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 8183775b49e..3e41a334350 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6082,6 +6082,7 @@ extern void reset_specialization (void); extern void end_specialization (void); extern void begin_explicit_instantiation (void); extern void end_explicit_instantiation (void); +extern void check_unqualified_spec_or_inst (tree, location_t); extern tree check_explicit_specialization (tree, tree, int, int); extern int num_template_headers_for_class (tree); extern void check_template_variable (tree); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 185c98bebb8..6101504e40b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7868,8 +7868,7 @@ check_class_member_definition_namespace (tree decl) diagnostics. */ if (processing_specialization) return; - /* There are no restrictions on the placement of - explicit instantiations. */ + /* We check this in check_explicit_instantiation_namespace. */ if (processing_explicit_instantiation) return; /* [class.mfct] diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index e574c271194..8db6cfdc334 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3558,7 +3558,7 @@ set_decl_namespace (tree decl, tree scope, bool friendp) /* Since decl is a function, old should contain a function decl. */ if (!is_overloaded_fn (old)) goto complain; - /* A template can be explicitly specialized in any namespace. */ + /* We handle these in check_explicit_instantiation_namespace. */ if (processing_explicit_instantiation) return; if (processing_template_decl || processing_specialization) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7b95dba72f2..b3b69b3b8be 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17004,24 +17004,28 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, globalscope = cp_parser_global_scope_opt (parser, /*current_scope_valid_p=*/false); /* Look for the nested-name-specifier. */ + tree nested_name_specifier; if (tag_type == typename_type && !globalscope) { - if (!cp_parser_nested_name_specifier (parser, + nested_name_specifier + = cp_parser_nested_name_specifier (parser, /*typename_keyword_p=*/true, /*check_dependency_p=*/true, /*type_p=*/true, - is_declaration)) + is_declaration); + if (!nested_name_specifier) return error_mark_node; } else /* Even though `typename' is not present, the proposed resolution to Core Issue 180 says that in `class A::B', `B' should be considered a type-name, even if `A' is dependent. */ - cp_parser_nested_name_specifier_opt (parser, - /*typename_keyword_p=*/true, - /*check_dependency_p=*/true, - /*type_p=*/true, - is_declaration); + nested_name_specifier + = cp_parser_nested_name_specifier_opt (parser, + /*typename_keyword_p=*/true, + /*check_dependency_p=*/true, + /*type_p=*/true, + is_declaration); /* For everything but enumeration types, consider a template-id. For an enumeration type, consider only a plain identifier. */ if (tag_type != enum_type) @@ -17069,8 +17073,18 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, else if (tag_type == typename_type && TREE_CODE (decl) != TYPE_DECL) ; else if (TREE_CODE (decl) == TYPE_DECL) - type = check_elaborated_type_specifier (tag_type, decl, - /*allow_template_p=*/true); + { + type = check_elaborated_type_specifier (tag_type, decl, + /*allow_template_p=*/true); + + /* If the next token is a semicolon, this must be a specialization, + instantiation, or friend declaration. Check the scope while we + still know whether or not we had a nested-name-specifier. */ + if (type != error_mark_node + && !nested_name_specifier && !is_friend + && cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) + check_unqualified_spec_or_inst (type, token->location); + } else if (decl == error_mark_node) type = error_mark_node; } @@ -22336,6 +22350,11 @@ cp_parser_class_head (cp_parser* parser, { type = TREE_TYPE (id); type = maybe_process_partial_specialization (type); + + /* Check the scope while we still know whether or not we had a + nested-name-specifier. */ + if (type != error_mark_node) + check_unqualified_spec_or_inst (type, type_start_token->location); } if (nested_name_specifier) pushed_scope = push_scope (nested_name_specifier); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d4855d5bc35..d9499d9284a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -772,28 +772,29 @@ check_specialization_namespace (tree tmpl) /* [tmpl.expl.spec] - An explicit specialization shall be declared in the namespace of - which the template is a member, or, for member templates, in the - namespace of which the enclosing class or enclosing class - template is a member. An explicit specialization of a member - function, member class or static data member of a class template - shall be declared in the namespace of which the class template is - a member. */ + An explicit specialization shall be declared in a namespace enclosing the + specialized template. An explicit specialization whose declarator-id is + not qualified shall be declared in the nearest enclosing namespace of the + template, or, if the namespace is inline (7.3.1), any namespace from its + enclosing namespace set. */ if (current_scope() != DECL_CONTEXT (tmpl) && !at_namespace_scope_p ()) { error ("specialization of %qD must appear at namespace scope", tmpl); return false; } - if (is_associated_namespace (current_namespace, tpl_ns)) - /* Same or super-using namespace. */ + + if (cxx_dialect < cxx11 + ? is_associated_namespace (current_namespace, tpl_ns) + : is_ancestor (current_namespace, tpl_ns)) + /* Same or enclosing namespace. */ return true; else { permerror (input_location, "specialization of %qD in different namespace", tmpl); - permerror (DECL_SOURCE_LOCATION (tmpl), - " from definition of %q#D", tmpl); + inform (DECL_SOURCE_LOCATION (tmpl), + " from definition of %q#D", tmpl); return false; } } @@ -2586,6 +2587,36 @@ check_template_variable (tree decl) } } +/* An explicit specialization whose declarator-id or class-head-name is not + qualified shall be declared in the nearest enclosing namespace of the + template, or, if the namespace is inline (7.3.1), any namespace from its + enclosing namespace set. + + If the name declared in the explicit instantiation is an unqualified name, + the explicit instantiation shall appear in the namespace where its template + is declared or, if that namespace is inline (7.3.1), any namespace from its + enclosing namespace set. */ + +void +check_unqualified_spec_or_inst (tree t, location_t loc) +{ + tree tmpl = most_general_template (t); + if (DECL_NAMESPACE_SCOPE_P (tmpl) + && !is_associated_namespace (current_namespace, + CP_DECL_CONTEXT (tmpl))) + { + if (processing_specialization) + permerror (loc, "explicit specialization of %qD outside its " + "namespace must use a nested-name-specifier", tmpl); + else if (processing_explicit_instantiation + && cxx_dialect >= cxx11) + /* This was allowed in C++98, so only pedwarn. */ + pedwarn (loc, OPT_Wpedantic, "explicit instantiation of %qD " + "outside its namespace must use a nested-name-" + "specifier", tmpl); + } +} + /* Check to see if the function just declared, as indicated in DECLARATOR, and in DECL, is a specialization of a function template. We may also discover that the declaration is an explicit @@ -2949,15 +2980,8 @@ check_explicit_specialization (tree declarator, return error_mark_node; else { - if (!ctype && !was_template_id - && (specialization || member_specialization - || explicit_instantiation) - && !is_associated_namespace (CP_DECL_CONTEXT (decl), - CP_DECL_CONTEXT (tmpl))) - error ("%qD is not declared in %qD", - tmpl, current_namespace); - else if (TREE_CODE (decl) == FUNCTION_DECL - && DECL_HIDDEN_FRIEND_P (tmpl)) + if (TREE_CODE (decl) == FUNCTION_DECL + && DECL_HIDDEN_FRIEND_P (tmpl)) { if (pedwarn (DECL_SOURCE_LOCATION (decl), 0, "friend declaration %qD is not visible to " @@ -2965,6 +2989,9 @@ check_explicit_specialization (tree declarator, inform (DECL_SOURCE_LOCATION (tmpl), "friend declaration here"); } + else if (!ctype && !is_friend + && CP_DECL_CONTEXT (decl) == current_namespace) + check_unqualified_spec_or_inst (tmpl, DECL_SOURCE_LOCATION (decl)); tree gen_tmpl = most_general_template (tmpl); diff --git a/gcc/testsuite/g++.dg/cpp0x/explicit-inst1.C b/gcc/testsuite/g++.dg/cpp0x/explicit-inst1.C new file mode 100644 index 00000000000..a6455d8310b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/explicit-inst1.C @@ -0,0 +1,13 @@ +// In C++11 explicit instantiation without a nested-name-specifier must be in +// the same namespace. + +namespace N { + template class foo {}; + template class bar {}; +} + +using N::bar; +template class bar; // { dg-error "" "" { target c++11 } } + +using namespace N; +template class foo; // { dg-error "" "" { target c++11 } } diff --git a/gcc/testsuite/g++.dg/template/spec17.C b/gcc/testsuite/g++.dg/template/spec17.C index 23755768423..91c5d56fc47 100644 --- a/gcc/testsuite/g++.dg/template/spec17.C +++ b/gcc/testsuite/g++.dg/template/spec17.C @@ -1,7 +1,7 @@ // PR c++/16224 namespace io { - template int foo(); // { dg-error "" } + template int foo(); } using namespace io; diff --git a/gcc/testsuite/g++.dg/template/spec25.C b/gcc/testsuite/g++.dg/template/spec25.C index 385d19ada0c..d6f0f08e280 100644 --- a/gcc/testsuite/g++.dg/template/spec25.C +++ b/gcc/testsuite/g++.dg/template/spec25.C @@ -1,10 +1,10 @@ namespace N { template struct S { - void f() {} // { dg-error "definition" } + void f() {} }; } namespace K { - template <> void N::S::f() {} // { dg-error "different namespace" } + template <> void N::S::f() {} // { dg-error "namespace" } } diff --git a/gcc/testsuite/g++.dg/template/spec36.C b/gcc/testsuite/g++.dg/template/spec36.C index 7e8dc5241d9..5807fc516df 100644 --- a/gcc/testsuite/g++.dg/template/spec36.C +++ b/gcc/testsuite/g++.dg/template/spec36.C @@ -8,9 +8,9 @@ struct basic_string namespace MyNS { class MyClass { template - T test() { } /* { dg-error "from definition" } */ + T test() { } /* { dg-message "from definition" "" { target c++98_only } } */ }; } template <> -basic_string MyNS::MyClass::test() /* { dg-error "specialization of" } */ +basic_string MyNS::MyClass::test() /* { dg-error "specialization of" "" { target c++98_only } }*/ { return 1; } diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template13.C b/gcc/testsuite/g++.old-deja/g++.ns/template13.C index a9559c7153b..e8e5304dae0 100644 --- a/gcc/testsuite/g++.old-deja/g++.ns/template13.C +++ b/gcc/testsuite/g++.old-deja/g++.ns/template13.C @@ -4,7 +4,7 @@ namespace bar { // trick it to provide some prior declaration template - void foo(); // { dg-error "definition" } + void foo(); templateclass X; // { dg-message "note: previous declaration" } } @@ -15,7 +15,7 @@ bar::foo(T const &a) // { dg-error "" "" { xfail *-*-* } } not declared in b return a; } -template<> void bar::foo() // { dg-error "different namespace" } +template<> void bar::foo() // { dg-error "different namespace" "" { target c++98_only } } { } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C index 1d83e346828..f8ceaf790c4 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit73.C @@ -7,7 +7,7 @@ // the template namespace N { - template class foo; // { dg-error "" } referenced below + template class foo; } using namespace N; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/lookup10.C b/gcc/testsuite/g++.old-deja/g++.pt/lookup10.C index 1c04250fc3c..9d2add8f627 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/lookup10.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/lookup10.C @@ -13,8 +13,8 @@ namespace Outer { namespace Core = Core_Real; namespace Core_Real { - template void Foo (T *) {} // { dg-error "definition" } + template void Foo (T *) {} } - template<> void Core::Foo<> (Render_Real::Type *) {} // { dg-error "" } + template<> void Core::Foo<> (Render_Real::Type *) {} // { dg-error "" "" { target c++98_only } } } diff --git a/libstdc++-v3/testsuite/30_threads/future/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/30_threads/future/requirements/explicit_instantiation.cc index 16325232204..87d423f1e8b 100644 --- a/libstdc++-v3/testsuite/30_threads/future/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/30_threads/future/requirements/explicit_instantiation.cc @@ -25,9 +25,8 @@ #include using namespace __gnu_test; -using std::future; -template class future; -template class future; -template class future; -template class future; -template class future; +template class std::future; +template class std::future; +template class std::future; +template class std::future; +template class std::future; diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/requirements/explicit_instantiation.cc index db90ff2c0f5..e3b61e4f418 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/requirements/explicit_instantiation.cc @@ -25,9 +25,8 @@ #include using namespace __gnu_test; -using std::packaged_task; -template class packaged_task; -template class packaged_task; -template class packaged_task; -template class packaged_task; -template class packaged_task; +template class std::packaged_task; +template class std::packaged_task; +template class std::packaged_task; +template class std::packaged_task; +template class std::packaged_task; diff --git a/libstdc++-v3/testsuite/30_threads/promise/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/30_threads/promise/requirements/explicit_instantiation.cc index 9691ab0445d..4a220a9deb6 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/requirements/explicit_instantiation.cc @@ -25,9 +25,8 @@ #include using namespace __gnu_test; -using std::promise; -template class promise; -template class promise; -template class promise; -template class promise; -template class promise; +template class std::promise; +template class std::promise; +template class std::promise; +template class std::promise; +template class std::promise; diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/30_threads/shared_future/requirements/explicit_instantiation.cc index a992b882fb0..715b7fe39c4 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_future/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_future/requirements/explicit_instantiation.cc @@ -25,9 +25,8 @@ #include using namespace __gnu_test; -using std::shared_future; -template class shared_future; -template class shared_future; -template class shared_future; -template class shared_future; -template class shared_future; +template class std::shared_future; +template class std::shared_future; +template class std::shared_future; +template class std::shared_future; +template class std::shared_future; diff --git a/libstdc++-v3/testsuite/ext/numeric_traits/numeric_traits.cc b/libstdc++-v3/testsuite/ext/numeric_traits/numeric_traits.cc index 61987433954..6653625be8c 100644 --- a/libstdc++-v3/testsuite/ext/numeric_traits/numeric_traits.cc +++ b/libstdc++-v3/testsuite/ext/numeric_traits/numeric_traits.cc @@ -21,7 +21,6 @@ #include -using __gnu_cxx::__numeric_traits; -template struct __numeric_traits; -template struct __numeric_traits; -template struct __numeric_traits; +template struct __gnu_cxx::__numeric_traits; +template struct __gnu_cxx::__numeric_traits; +template struct __gnu_cxx::__numeric_traits; diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/enable_shared_from_this/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/enable_shared_from_this/requirements/explicit_instantiation/1.cc index a7b967f30ab..18d94dfa71c 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/enable_shared_from_this/requirements/explicit_instantiation/1.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/enable_shared_from_this/requirements/explicit_instantiation/1.cc @@ -23,8 +23,7 @@ // { dg-do compile } using namespace __gnu_test; -using std::tr1::enable_shared_from_this; -template class enable_shared_from_this; -template class enable_shared_from_this; -template class enable_shared_from_this; -template class enable_shared_from_this; +template class std::tr1::enable_shared_from_this; +template class std::tr1::enable_shared_from_this; +template class std::tr1::enable_shared_from_this; +template class std::tr1::enable_shared_from_this; diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/1.cc index 794deaffe8d..918822d0681 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/1.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/1.cc @@ -23,8 +23,7 @@ // { dg-do compile } using namespace __gnu_test; -using std::tr1::shared_ptr; -template class shared_ptr; -template class shared_ptr; -template class shared_ptr; -template class shared_ptr; +template class std::tr1::shared_ptr; +template class std::tr1::shared_ptr; +template class std::tr1::shared_ptr; +template class std::tr1::shared_ptr; diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/2.cc index 93587b293f7..870e888b382 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/2.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/2.cc @@ -26,8 +26,7 @@ // library this checks the templates can be instantiated for non-default // lock policy, for a single-threaded lib this is redundant but harmless. using namespace __gnu_test; -using std::tr1::__shared_ptr; using std::tr1::_S_single; -template class __shared_ptr; -template class __shared_ptr; -template class __shared_ptr; +template class std::tr1::__shared_ptr; +template class std::tr1::__shared_ptr; +template class std::tr1::__shared_ptr; diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/1.cc index d64517c30c4..0680ead9c3e 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/1.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/1.cc @@ -23,8 +23,7 @@ // { dg-do compile } using namespace __gnu_test; -using std::tr1::weak_ptr; -template class weak_ptr; -template class weak_ptr; -template class weak_ptr; -template class weak_ptr; +template class std::tr1::weak_ptr; +template class std::tr1::weak_ptr; +template class std::tr1::weak_ptr; +template class std::tr1::weak_ptr; diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/2.cc index 672e637d5f7..31617c9152c 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/2.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/2.cc @@ -26,9 +26,8 @@ // library this checks the templates can be instantiated for non-default // lock policy, for a single-threaded lib this is redundant but harmless. using namespace __gnu_test; -using std::tr1::__weak_ptr; using std::tr1::_S_single; -template class __weak_ptr; -template class __weak_ptr; -template class __weak_ptr; -template class __weak_ptr; +template class std::tr1::__weak_ptr; +template class std::tr1::__weak_ptr; +template class std::tr1::__weak_ptr; +template class std::tr1::__weak_ptr; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/explicit_instantiation.cc index aba574d66dd..5f017c70461 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/hash/requirements/explicit_instantiation.cc @@ -24,27 +24,25 @@ #include #include -using namespace std::tr1; - // Verify that we can instantiate hash for every required type. -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; -template class hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; +template class std::tr1::hash; #ifdef _GLIBCXX_USE_WCHAR_T -template class hash; -template class hash; +template class std::tr1::hash; +template class std::tr1::hash; #endif diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/explicit_instantiation.cc index f659817d72f..60ac8a5bef1 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_map/requirements/explicit_instantiation.cc @@ -30,13 +30,13 @@ using std::allocator; using std::pair; using std::equal_to; -template class unordered_map; -template class unordered_map; +template class std::tr1::unordered_map, equal_to, allocator > >; -template class unordered_map, equal_to, allocator >; -template class __unordered_map, equal_to, allocator >, true>; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/explicit_instantiation.cc index 5b72ae9b8eb..e92da828ff5 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/requirements/explicit_instantiation.cc @@ -30,13 +30,13 @@ using std::equal_to; using std::allocator; using std::pair; -template class unordered_multimap; -template class unordered_multimap; +template class std::tr1::unordered_multimap, equal_to, allocator > >; -template class unordered_multimap, equal_to, allocator >; -template class __unordered_multimap, equal_to, allocator >, true>; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/explicit_instantiation.cc index a1605266c8c..662184beed6 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/requirements/explicit_instantiation.cc @@ -27,10 +27,10 @@ using namespace std::tr1; using std::equal_to; using std::allocator; -template class unordered_multiset; -template class unordered_multiset, equal_to, +template class std::tr1::unordered_multiset; +template class std::tr1::unordered_multiset, equal_to, allocator >; -template class unordered_multiset, equal_to, +template class std::tr1::unordered_multiset, equal_to, allocator >; -template class __unordered_multiset, equal_to, +template class std::tr1::__unordered_multiset, equal_to, allocator, true>; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/explicit_instantiation.cc index 15679e1e629..5d4d83d743e 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered_set/requirements/explicit_instantiation.cc @@ -27,10 +27,10 @@ using namespace std::tr1; using std::equal_to; using std::allocator; -template class unordered_set; -template class unordered_set, equal_to, - allocator >; -template class unordered_set, equal_to, - allocator >; -template class __unordered_set, equal_to, - allocator, true>; +template class std::tr1::unordered_set; +template class std::tr1::unordered_set, equal_to, + allocator >; +template class std::tr1::unordered_set, equal_to, + allocator >; +template class std::tr1::__unordered_set, equal_to, + allocator, true>; -- 2.30.2