[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Andrew Pinski changed: What|Removed |Added CC||Simon.Richter at hogyros dot de --- Comment #14 from Andrew Pinski --- *** Bug 42018 has been marked as a duplicate of this bug. ***
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Andrew Pinski changed: What|Removed |Added CC||redi at gcc dot gnu.org --- Comment #13 from Andrew Pinski --- *** Bug 60786 has been marked as a duplicate of this bug. ***
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Jason Merrill changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #12 from Jason Merrill --- *** Bug 78274 has been marked as a duplicate of this bug. ***
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Jason Merrill changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED Target Milestone|5.5 |7.0 --- Comment #11 from Jason Merrill --- Author: jason Date: Sun Nov 13 06:51:23 2016 New Revision: 242348 URL: https://gcc.gnu.org/viewcvs?rev=242348=gcc=rev Log: 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. Added: trunk/gcc/testsuite/g++.dg/cpp0x/explicit-inst1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/decl.c trunk/gcc/cp/name-lookup.c trunk/gcc/cp/parser.c trunk/gcc/cp/pt.c
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Jason Merrill changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Pedro80 changed: What|Removed |Added CC||mtlroom at hotmail dot com --- Comment #10 from Pedro80 --- What an annoying bug, can this finally be fixed?! Our code base heavily relies on this feature alone as it's used in reflection code to specialize templates for certain types and it's done by expansion of preprocessor macro. This bug alone prevents us from using gcc as we heavily use this perfectly normal code: namespace NS1 { namespace NS2 { template int someFunction(); } } #define REGISTER(type) template<>NS1::NS2::someFunction() { return something; } and then that REGISTER macro can be used in global namespace or inside NS1 or NS2.
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Richard Biener changed: What|Removed |Added Target Milestone|5.4 |5.5 --- Comment #9 from Richard Biener --- GCC 5.4 is being released, adjusting target milestone.
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Richard Biener changed: What|Removed |Added Target Milestone|5.3 |5.4 --- Comment #8 from Richard Biener --- GCC 5.3 is being released, adjusting target milestone.
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Target Milestone|5.2 |5.3 --- Comment #7 from Richard Biener rguenth at gcc dot gnu.org --- GCC 5.2 is being released, adjusting target milestone to 5.3.
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Target Milestone|5.0 |5.2 --- Comment #6 from Jakub Jelinek jakub at gcc dot gnu.org --- GCC 5.1 has been released.
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Markus Trippelsdorf trippels at gcc dot gnu.org changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |trippels at gcc dot gnu.org Target Milestone|--- |5.0
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Markus Trippelsdorf trippels at gcc dot gnu.org changed: What|Removed |Added CC||trippels at gcc dot gnu.org --- Comment #4 from Markus Trippelsdorf trippels at gcc dot gnu.org --- *** Bug 63705 has been marked as a duplicate of this bug. ***
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Markus Trippelsdorf trippels at gcc dot gnu.org changed: What|Removed |Added Keywords||rejects-valid CC||jason at gcc dot gnu.org --- Comment #5 from Markus Trippelsdorf trippels at gcc dot gnu.org --- Two possible fixes: 1) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2cf10f442f68..09a545496fa8 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -785,8 +785,12 @@ check_specialization_namespace (tree tmpl) return true; else { - permerror (input_location, specialization of %qD in different namespace, tmpl); - permerror (input_location, from definition of %q+#D, tmpl); + if (cxx_dialect cxx11) + { + permerror (input_location, specialization of %qD in different +namespace, tmpl); + permerror (input_location, from definition of %q+#D, tmpl); + } return false; } } 2) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2cf10f442f68..1171b5d736d5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -780,15 +780,15 @@ check_specialization_namespace (tree tmpl) 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. */ -return true; - else + if (!is_associated_namespace (current_namespace, tpl_ns) + (cxx_dialect cxx11)) { permerror (input_location, specialization of %qD in different namespace, tmpl); permerror (input_location, from definition of %q+#D, tmpl); return false; } + + return true; } /* SPEC is an explicit instantiation. Check that it is valid to The following testcases: g++.dg/template/spec17.C g++.dg/template/spec25.C g++.dg/template/spec36.C g++.old-deja/g++.ns/template13.C g++.old-deja/g++.pt/explicit73.C g++.old-deja/g++.pt/lookup10.C would have to be updated.
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Zhihao Yuan lichray at gmail dot com changed: What|Removed |Added CC||lichray at gmail dot com --- Comment #3 from Zhihao Yuan lichray at gmail dot com --- (In reply to Nathan Ridge from comment #2) (In reply to comment #1) I think this is http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#374 Ah, I see. The code is accepted if a declaration (without definition) of the specialization is placed in the namespace. Didn't realize that. ?? That was the c++03 status, and the new wording (or to a specialization thereof) relaxed this requirement. Has this been implemented?
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Jonathan Wakely redi at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2013-03-05 Ever Confirmed|0 |1 --- Comment #1 from Jonathan Wakely redi at gcc dot gnu.org 2013-03-05 01:29:27 UTC --- I think this is http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#374
[Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 --- Comment #2 from Nathan Ridge zeratul976 at hotmail dot com 2013-03-05 04:30:26 UTC --- (In reply to comment #1) I think this is http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#374 Ah, I see. The code is accepted if a declaration (without definition) of the specialization is placed in the namespace. Didn't realize that.