re PR c++/32596 (ICE with inline template specialization in anonymous namespace)
authorJakub Jelinek <jakub@redhat.com>
Tue, 28 Aug 2007 16:08:02 +0000 (18:08 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 28 Aug 2007 16:08:02 +0000 (18:08 +0200)
PR c++/32596
PR c++/32400
* pt.c (check_explicit_specialization): Set DECL_INTERFACE_KNOWN
and DECL_NOT_REALLY_EXTERN if tmpl_func is not public.

* g++.dg/ext/visibility/anon5.C: New test.

From-SVN: r127863

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/visibility/anon5.C [new file with mode: 0644]

index 03d6b51c1a634c1c89d315f0bf6c79ba40f297f7..f612c9cb9d6ad26219a37918997e55e1c5e51281 100644 (file)
@@ -1,3 +1,10 @@
+2007-08-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/32596
+       PR c++/32400
+       * pt.c (check_explicit_specialization): Set DECL_INTERFACE_KNOWN
+       and DECL_NOT_REALLY_EXTERN if tmpl_func is not public.
+
 2007-08-27  Jason Merrill  <jason@redhat.com>
 
        PR c++/28558
index 1bbe6cb80c6f6db917edb7cb1f25806208e4dd16..e33197c5c45dd33256b2959a22f16a194b36adb9 100644 (file)
@@ -2217,6 +2217,11 @@ check_explicit_specialization (tree declarator,
               /* This specialization has the same linkage and visibility as
                  the function template it specializes.  */
               TREE_PUBLIC (decl) = TREE_PUBLIC (tmpl_func);
+             if (! TREE_PUBLIC (decl))
+               {
+                 DECL_INTERFACE_KNOWN (decl) = 1;
+                 DECL_NOT_REALLY_EXTERN (decl) = 1;
+               }
               DECL_THIS_STATIC (decl) = DECL_THIS_STATIC (tmpl_func);
               if (DECL_VISIBILITY_SPECIFIED (tmpl_func))
                 {
index 1ab202ab167a04672bf22234eed6d80c633f8187..0bbe27a9befcb7da6f245945f707d1041d43dd0c 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/32596
+       * g++.dg/ext/visibility/anon5.C: New test.
+
 2007-07-28  Dominique d'Humieres  <dominiq@lps.ens.fr>
 
        * gfortran.dg/gamma_4.f90: Fix large-real kind selection.
diff --git a/gcc/testsuite/g++.dg/ext/visibility/anon5.C b/gcc/testsuite/g++.dg/ext/visibility/anon5.C
new file mode 100644 (file)
index 0000000..d069eea
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/32596
+// { dg-do compile }
+
+namespace
+{
+  template<class T> inline void char_less(void) { }
+  template<> inline void char_less<char>(void) { }
+}