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]

[C++ PATCH]: fix bug 127


Hi,
I've installed this patch which fixes bug 127 where T<S> caused an
ICE when T was not a template type.

built & tested on i686-pc-linux-gnu, approved by Mark

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-09-01  Nathan Sidwell  <nathan@codesourcery.com>

	* pt.c (lookup_template_class): Remove abort.
	* tree.c (get_type_decl): Allow error_mark_node.

Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.461
diff -c -3 -p -r1.461 pt.c
*** pt.c	2000/08/29 21:39:48	1.461
--- pt.c	2000/09/01 10:28:44
*************** lookup_template_class (d1, arglist, in_d
*** 3770,3783 ****
        d1 = DECL_NAME (template);
        context = DECL_CONTEXT (template);
      }
-   else
-     my_friendly_abort (272);
  
    /* With something like `template <class T> class X class X { ... };'
       we could end up with D1 having nothing but an IDENTIFIER_VALUE.
       We don't want to do that, but we have to deal with the situation,
       so let's give them some syntax errors to chew on instead of a
!      crash.  */
    if (! template)
      {
        cp_error ("`%T' is not a template", d1);
--- 3770,3781 ----
        d1 = DECL_NAME (template);
        context = DECL_CONTEXT (template);
      }
  
    /* With something like `template <class T> class X class X { ... };'
       we could end up with D1 having nothing but an IDENTIFIER_VALUE.
       We don't want to do that, but we have to deal with the situation,
       so let's give them some syntax errors to chew on instead of a
!      crash. Alternatively D1 might not be a template type at all.  */
    if (! template)
      {
        cp_error ("`%T' is not a template", d1);
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tree.c,v
retrieving revision 1.210
diff -c -3 -p -r1.210 tree.c
*** tree.c	2000/08/30 23:43:53	1.210
--- tree.c	2000/09/01 10:28:44
*************** get_type_decl (t)
*** 1846,1851 ****
--- 1846,1853 ----
      return t;
    if (TYPE_P (t))
      return TYPE_STUB_DECL (t);
+   if (t == error_mark_node)
+     return t;
    
    my_friendly_abort (42);
  
// Build don't link:
// 
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 1 Sep 2000 <nathan@codesourcery.com>

// bug 127. We ICE'd when given a non-template TYPE_DECL as a template name.

template <class charT>
class basic_string
{
public:
  typedef charT* iterator;
  explicit basic_string ();
  ~basic_string ();
};

void foo () {
  basic_string<char>::iterator<char> p; // ERROR - not a template // ERROR - no type
}

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