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: static member in template class


>>>>> "Ulrich" == Ulrich Drepper <drepper@cygnus.com> writes:

    Ulrich> This is with a quite recent egcs version.  Compiling the
    Ulrich> program below with

    Ulrich> 	gcc -c y.cc

    Ulrich> leads to the following message:

    Ulrich> y.cc:11: conflicting types for `int foo<int>::bar[0]'
    Ulrich> y.cc:8: previous declaration as `int foo<int>::bar[0]'

This bug was exposed my recent changes to array type-checking.  It is
not the fault of those changes; just a consequence.

On the one hand, the attached patch fixes it.  On the other hand, the
middle-end has a bizarre inconsistency.  More on that in another mail.

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

1998-11-03  Mark Mitchell  <mark@markmitchell.com>

	* pt.c (tsubst): Use build_index_type, not build_index_2_type.

Index: pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.228
diff -c -p -r1.228 pt.c
*** pt.c	1998/11/01 15:45:05	1.228
--- pt.c	1998/11/04 06:24:27
*************** tsubst (t, args, in_decl)
*** 5542,5548 ****
  	  }
  
  	max = fold (build_binary_op (MINUS_EXPR, max, integer_one_node, 1));
! 	return build_index_2_type (size_zero_node, max);
        }
  
      case TEMPLATE_TYPE_PARM:
--- 5542,5548 ----
  	  }
  
  	max = fold (build_binary_op (MINUS_EXPR, max, integer_one_node, 1));
! 	return build_index_type (max);
        }
  
      case TEMPLATE_TYPE_PARM:


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