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]

Re: Unresolved issue


>>>>> "Jason" == Jason Merrill <jason@cygnus.com> writes:

>>>>> Mark Mitchell <mark@markmitchell.com> writes:

    >> * pt.c (process_template_parm): Clear IS_AGGR_TYPE for
    >> TEMPLATE_TYPE_PARMs.

    Jason> We set IS_AGGR_TYPE on those deliberately, so that things
    Jason> that require a class don't complain about template parms.

OK.  I ran into the opposite case: I wanted it unset so that we
couldn't complain about template parms where a class type was
*forbidden*.  I restored the behavior, and documented it in the
following patch. 

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

1998-08-24  Mark Mitchell  <mark@markmitchell.com>

	* cp-tree.h (CLASS_TYPE_P): New macro.
	* decl.c (grokdeclarator): Use it instead of IS_AGGR_TYPE.
	* pt.c (process_template_parm): Undo previous change.

Index: cp-tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.114
diff -c -p -r1.114 cp-tree.h
*** cp-tree.h	1998/08/24 02:08:40	1.114
--- cp-tree.h	1998/08/24 18:51:01
*************** enum languages { lang_c, lang_cplusplus,
*** 498,504 ****
--- 498,513 ----
  /* The _DECL for this _TYPE.  */
  #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
  
+ /* Nonzero if T is a class (or struct or union) type.  Also nonzero
+    for template type parameters.  Despite its name, this macro has
+    nothing to do with the definition of aggregate given in the
+    standard.  Think of this macro as MAYBE_CLASS_TYPE_P.  */
  #define IS_AGGR_TYPE(t)		(TYPE_LANG_FLAG_5 (t))
+ 
+ /* Nonzero if T is a class type.  Zero for template type parameters.  */
+ #define CLASS_TYPE_P(t) \
+   (IS_AGGR_TYPE (t) && TREE_CODE (t) != TEMPLATE_TYPE_PARM)
+ 
  #define IS_AGGR_TYPE_CODE(t)	(t == RECORD_TYPE || t == UNION_TYPE)
  #define IS_AGGR_TYPE_2(TYPE1,TYPE2) \
    (TREE_CODE (TYPE1) == TREE_CODE (TYPE2)	\
Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.188
diff -c -p -r1.188 decl.c
*** decl.c	1998/08/24 02:08:42	1.188
--- decl.c	1998/08/24 18:51:41
*************** grokdeclarator (declarator, declspecs, d
*** 10434,10440 ****
  		   but not both.  If it appears in the class, the member is
  		   a member constant.  The file-scope definition is always
  		   required.  */
! 		if (IS_AGGR_TYPE (type)
  		    || TREE_CODE (type) == REFERENCE_TYPE)
  		  {
  		    cp_error ("in-class initialization of static data member of non-integral type `%T'", 
--- 10434,10440 ----
  		   but not both.  If it appears in the class, the member is
  		   a member constant.  The file-scope definition is always
  		   required.  */
! 		if (CLASS_TYPE_P (type)
  		    || TREE_CODE (type) == REFERENCE_TYPE)
  		  {
  		    cp_error ("in-class initialization of static data member of non-integral type `%T'", 
Index: pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.184
diff -c -p -r1.184 pt.c
*** pt.c	1998/08/24 11:57:04	1.184
--- pt.c	1998/08/24 19:06:23
*************** process_template_parm (list, next)
*** 1610,1616 ****
        else
  	{
  	  t = make_lang_type (TEMPLATE_TYPE_PARM);
- 	  IS_AGGR_TYPE (t) = 0;
  	  /* parm is either IDENTIFIER_NODE or NULL_TREE */
  	  decl = build_decl (TYPE_DECL, parm, t);
  	}
--- 1610,1615 ----


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