OSDN Git Service

Fix candidate for PR c++/43206
[pf3gnuchains/gcc-fork.git] / gcc / cp / pt.c
index 06f5d9f..bb8749b 100644 (file)
@@ -1,6 +1,6 @@
 /* Handle parameterized types (templates) for GNU C++.
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+   2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
    Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
    Rewritten by Jason Merrill (jason@cygnus.com).
@@ -2852,7 +2852,7 @@ get_primary_template_innermost_parameters (const_tree t)
    of template parameters PARMS.  */
 
 tree
-get_template_parms_at_level (tree parms, int level)
+get_template_parms_at_level (tree parms, unsigned level)
 {
   tree p;
   if (!parms
@@ -3837,7 +3837,7 @@ process_partial_specialization (tree decl)
   int nargs = TREE_VEC_LENGTH (inner_args);
   int ntparms;
   int  i;
-  int did_error_intro = 0;
+  bool did_error_intro = false;
   struct template_parm_data tpd;
   struct template_parm_data tpd2;
 
@@ -3899,12 +3899,15 @@ process_partial_specialization (tree decl)
        if (!did_error_intro)
          {
            error ("template parameters not used in partial specialization:");
-           did_error_intro = 1;
+           did_error_intro = true;
          }
 
        error ("        %qD", TREE_VALUE (TREE_VEC_ELT (inner_parms, i)));
       }
 
+  if (did_error_intro)
+    return error_mark_node;
+
   /* [temp.class.spec]
 
      The argument list of the specialization shall not be identical to
@@ -10147,7 +10150,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
              }
            else
              /* TEMPLATE_TEMPLATE_PARM or TEMPLATE_PARM_INDEX.  */
-             return arg;
+             return unshare_expr (arg);
          }
 
        if (level == 1)