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]

[C++ Patch] PR 33461


Hi,

rather straightforward, matter of error checking. Tested x86_64-linux.

Ok for mainline?

Paolo.

///////////////////
/cp
2007-09-27  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33461
	* pt.c (coerce_template_parameter_pack): Do not pass error_mark_node
	to convert_template_argument.
	(coerce_template_parms): Return error_mark_node after fixed-length
	error.
	(tsubst_decl): Check for error_mark_node the return value of the
	first tsubst in 'case VAR_DECL'.

/testsuite
2007-09-27  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33461
	* g++.dg/cpp0x/variadic81.C: New.
	* g++.dg/cpp0x/variadic82.C: Likewise.
Index: testsuite/g++.dg/cpp0x/variadic82.C
===================================================================
*** testsuite/g++.dg/cpp0x/variadic82.C	(revision 0)
--- testsuite/g++.dg/cpp0x/variadic82.C	(revision 0)
***************
*** 0 ****
--- 1,11 ----
+ // PR c++/33461
+ // { dg-options "-std=gnu++0x" }
+ 
+ template<typename> struct A;
+ 
+ template<typename... T> struct A<T*...> // { dg-error "cannot expand" }
+ {
+   struct B;
+ };
+ 
+ A<void*> a; // { dg-error "incomplete type" }
Index: testsuite/g++.dg/cpp0x/variadic81.C
===================================================================
*** testsuite/g++.dg/cpp0x/variadic81.C	(revision 0)
--- testsuite/g++.dg/cpp0x/variadic81.C	(revision 0)
***************
*** 0 ****
--- 1,11 ----
+ // PR c++/33461
+ // { dg-options "-std=gnu++0x" }
+ 
+ template<typename> struct A;
+ 
+ template<typename... T> struct A<T*>  // { dg-error "not expanded|note" }
+ {                                     // { dg-error "not expanded|note" }
+   struct B;
+ };
+ 
+ A<void*> a;
Index: cp/pt.c
===================================================================
*** cp/pt.c	(revision 128842)
--- cp/pt.c	(working copy)
*************** coerce_template_parameter_pack (tree par
*** 4933,4941 ****
              TREE_VEC_ELT (packed_types, arg_idx - parm_idx);
          }
  
!       arg = convert_template_argument (actual_parm, 
!                                        arg, new_args, complain, parm_idx,
!                                        in_decl);
        if (arg == error_mark_node)
          (*lost)++;
        TREE_VEC_ELT (packed_args, arg_idx - parm_idx) = arg; 
--- 4933,4942 ----
              TREE_VEC_ELT (packed_types, arg_idx - parm_idx);
          }
  
!       if (arg != error_mark_node)
! 	arg = convert_template_argument (actual_parm, 
! 					 arg, new_args, complain, parm_idx,
! 					 in_decl);
        if (arg == error_mark_node)
          (*lost)++;
        TREE_VEC_ELT (packed_args, arg_idx - parm_idx) = arg; 
*************** coerce_template_parms (tree parms,
*** 5086,5091 ****
--- 5087,5093 ----
                else
                  error ("cannot expand %<%T%> into a fixed-length "
                         "argument list", arg);
+ 	      return error_mark_node;
              }
          }
        else if (require_all_args)
*************** tsubst_decl (tree t, tree args, tsubst_f
*** 8087,8092 ****
--- 8089,8096 ----
  	       TYPE_NAME is not correct for the above test if
  	       we've copied the type for a typedef.  */
  	    type = tsubst (TREE_TYPE (t), args, complain, in_decl);
+ 	    if (type == error_mark_node)
+ 	      return error_mark_node;
  	    r = TYPE_NAME (type);
  	    break;
  	  }

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