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]

Re: PR c++/42758


On 01/26/2010 08:36 AM, Dodji Seketeli wrote:
+#define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) __extension__ \
+({ \
+    gcc_assert (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE)); \
+    int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE)); \
+})

You don't actually need the assert, just using the value will SEGV if it isn't set.


+#if ENABLE_CHECKING

Should be #ifdef.


@@ -8334,20 +8371,30 @@ tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl)
       tree new_arg;

       if (TREE_CODE (orig_arg) == TREE_VEC)
-	new_arg = tsubst_template_args (orig_arg, args, complain, in_decl);
+	{
+	  new_arg = tsubst_template_args (orig_arg, args, complain, in_decl);
+	  non_default_args_count =
+		GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (orig_arg);
+	}
       else if (PACK_EXPANSION_P (orig_arg))
         {
           /* Substitute into an expansion expression.  */
           new_arg = tsubst_pack_expansion (orig_arg, args, complain, in_decl);
+	  if (non_default_args_count < 0 && new_arg != error_mark_node)
+	    non_default_args_count =
+	      GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (orig_t);
...

This looks wrong. non_default_args_count for the new t should always be the count from orig_t + expanded_len_adjust. A nested TREE_VEC will have its own count that we don't care about here.


Jason


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