From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8304 invoked by alias); 1 Nov 2014 18:05:48 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 8263 invoked by uid 48); 1 Nov 2014 18:05:44 -0000 From: "trippels at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56480] Explicit specialization in a namespace enclosing the specialized template Date: Sat, 01 Nov 2014 18:05:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: trippels at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-11/txt/msg00016.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 Markus Trippelsdorf changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid CC| |jason at gcc dot gnu.org --- Comment #5 from Markus Trippelsdorf --- 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.