public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "trippels at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-56480-4-VdGWSli1lp@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56480-4@http.gcc.gnu.org/bugzilla/>

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.


  parent reply	other threads:[~2014-11-01 18:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-28  8:18 [Bug c++/56480] New: " zeratul976 at hotmail dot com
2013-03-05  1:29 ` [Bug c++/56480] " redi at gcc dot gnu.org
2013-03-05  4:30 ` zeratul976 at hotmail dot com
2013-11-29 23:49 ` lichray at gmail dot com
2014-11-01 15:51 ` trippels at gcc dot gnu.org
2014-11-01 18:05 ` trippels at gcc dot gnu.org [this message]
2014-11-02 11:48 ` trippels at gcc dot gnu.org
2015-04-22 12:06 ` jakub at gcc dot gnu.org
2015-07-16  9:13 ` rguenth at gcc dot gnu.org
2021-08-04 20:42 ` pinskia at gcc dot gnu.org
2021-08-23  8:33 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-56480-4-VdGWSli1lp@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).