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]

Dumping contexts


Given the error message for

namespace S{
template<class T>
struct Y{
  Y(){}
  ~Y(){}
};
}

void g()
{
  S::Y<int> f;
  f.foo();
}

(no matching function for call to `::S::::S::Y<int>::foo ()')

I propose the patch below.

Martin

1998-07-23  Martin von L÷wis  <loewis@informatik.hu-berlin.de>

	* error.c (dump_aggr_type): Do not prefix template instantiations
	with their context
	(dump_decl): Omit context if it is NULL_TREE.

Index: error.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/error.c,v
retrieving revision 1.49
diff -c -p -r1.49 error.c
*** error.c	1998/07/19 17:54:13	1.49
--- error.c	1998/07/23 07:17:08
*************** dump_aggr_type (t, v, canonical_name)
*** 352,358 ****
    
    name = TYPE_NAME (canonical_name ? TYPE_MAIN_VARIANT (t) : t);
  
!   if (name && DECL_CONTEXT (name) && DECL_CONTEXT (name) != global_namespace)
      {
        /* FUNCTION_DECL or RECORD_TYPE */
        dump_decl (DECL_CONTEXT (name), 0);
--- 352,359 ----
    
    name = TYPE_NAME (canonical_name ? TYPE_MAIN_VARIANT (t) : t);
  
!   if (name && DECL_CONTEXT (name) && DECL_CONTEXT (name) != global_namespace
!       && !(TYPE_LANG_SPECIFIC (t) && CLASSTYPE_USE_TEMPLATE (t)))
      {
        /* FUNCTION_DECL or RECORD_TYPE */
        dump_decl (DECL_CONTEXT (name), 0);
*************** dump_decl (t, v)
*** 728,734 ****
        break;
  
      case NAMESPACE_DECL:
!       if (DECL_CONTEXT (t) != global_namespace)
  	{
  	  dump_decl (DECL_CONTEXT (t), v);
  	  OB_PUTC2 (':',':');
--- 729,735 ----
        break;
  
      case NAMESPACE_DECL:
!       if (DECL_CONTEXT (t) != NULL_TREE)
  	{
  	  dump_decl (DECL_CONTEXT (t), v);
  	  OB_PUTC2 (':',':');


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