This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR 16171: Check for namespace first


Hi folks

The patch fixes the wrong mangeling of basic_*stream templates in
namespace != std.

It just moves the check for the namespace before the check of the actual
type within the namespace.

diff -ur gcc-20050904.orig/gcc/cp/mangle.c gcc-20050904/gcc/cp/mangle.c
--- gcc-20050904.orig/gcc/cp/mangle.c	2005-06-27 07:44:06.000000000 +0000
+++ gcc-20050904/gcc/cp/mangle.c	2005-09-10 21:44:14.475107296 +0000
@@ -589,47 +589,47 @@
 	}
     }
 
-  /* Check for basic_{i,o,io}stream.  */
-  if (TYPE_P (node)
-      && cp_type_quals (type) == TYPE_UNQUALIFIED
-      && CLASS_TYPE_P (type)
-      && CLASSTYPE_USE_TEMPLATE (type)
-      && CLASSTYPE_TEMPLATE_INFO (type) != NULL)
-    {
-      /* First, check for the template
-	 args <char, std::char_traits<char> > .  */
-      tree args = CLASSTYPE_TI_ARGS (type);
-      if (TREE_VEC_LENGTH (args) == 2
-	  && TYPE_P (TREE_VEC_ELT (args, 0))
-	  && same_type_p (TREE_VEC_ELT (args, 0), char_type_node)
-	  && is_std_substitution_char (TREE_VEC_ELT (args, 1),
-				       SUBID_CHAR_TRAITS))
-	{
-	  /* Got them.  Is this basic_istream?  */
-	  tree name = DECL_NAME (CLASSTYPE_TI_TEMPLATE (type));
-	  if (name == subst_identifiers[SUBID_BASIC_ISTREAM])
-	    {
-	      write_string ("Si");
-	      return 1;
-	    }
-	  /* Or basic_ostream?  */
-	  else if (name == subst_identifiers[SUBID_BASIC_OSTREAM])
-	    {
-	      write_string ("So");
-	      return 1;
-	    }
-	  /* Or basic_iostream?  */
-	  else if (name == subst_identifiers[SUBID_BASIC_IOSTREAM])
-	    {
-	      write_string ("Sd");
-	      return 1;
-	    }
-	}
-    }
-
   /* Check for namespace std.  */
   if (decl && DECL_NAMESPACE_STD_P (decl))
     {
+      /* Check for basic_{i,o,io}stream.  */
+      if (TYPE_P (node)
+          && cp_type_quals (type) == TYPE_UNQUALIFIED
+          && CLASS_TYPE_P (type)
+          && CLASSTYPE_USE_TEMPLATE (type)
+          && CLASSTYPE_TEMPLATE_INFO (type) != NULL)
+        {
+          /* First, check for the template
+             args <char, std::char_traits<char> > .  */
+          tree args = CLASSTYPE_TI_ARGS (type);
+          if (TREE_VEC_LENGTH (args) == 2
+              && TYPE_P (TREE_VEC_ELT (args, 0))
+              && same_type_p (TREE_VEC_ELT (args, 0), char_type_node)
+              && is_std_substitution_char (TREE_VEC_ELT (args, 1),
+                                           SUBID_CHAR_TRAITS))
+            {
+              /* Got them.  Is this basic_istream?  */
+              tree name = DECL_NAME (CLASSTYPE_TI_TEMPLATE (type));
+              if (name == subst_identifiers[SUBID_BASIC_ISTREAM])
+                {
+                  write_string ("Si");
+                  return 1;
+                }
+              /* Or basic_ostream?  */
+              else if (name == subst_identifiers[SUBID_BASIC_OSTREAM])
+                {
+                  write_string ("So");
+                  return 1;
+                }
+              /* Or basic_iostream?  */
+              else if (name == subst_identifiers[SUBID_BASIC_IOSTREAM])
+                {
+                  write_string ("Sd");
+                  return 1;
+                }
+            }
+        }
+
       write_string ("St");
       return 1;
     }
-

Bastian

-- 
In the strict scientific sense we all feed on death -- even vegetarians.
		-- Spock, "Wolf in the Fold", stardate 3615.4

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]