C++ PATCH for yet another name-lookup regression

Mark Mitchell mark@codesourcery.com
Thu Apr 8 13:06:00 GMT 1999


We're still shaking the bugs out of the name lookup improvements that
went in last week.  Here's another small fix.

-- 
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

1999-04-08  Mark Mitchell  <mark@codesourcery.com>

	* search.c (template_self_reference_p): Tweak.

Index: testsuite/g++.old-deja/g++.pt/crash34.C
===================================================================
RCS file: crash34.C
diff -N crash34.C
*** /dev/null	Sat Dec  5 20:30:03 1998
--- crash34.C	Thu Apr  8 11:44:54 1999
***************
*** 0 ****
--- 1,20 ----
+ // Build don't link:
+ // Origin: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+ 
+ template <class T>
+ class A {
+ public:
+         class B { };
+         class C: public B {
+         public:
+                 C(A&):B() { }
+         };
+         C f() { return C(*this); }
+ };
+ 
+ int
+ main()
+ {
+         A<int> a;
+         a.f();
+ }
Index: cp/search.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/search.c,v
retrieving revision 1.93
diff -c -p -r1.93 search.c
*** search.c	1999/04/06 14:38:06	1.93
--- search.c	1999/04/08 18:45:24
*************** template_self_reference_p (type, decl)
*** 1190,1195 ****
--- 1190,1196 ----
       tree decl;
  {
    return  (CLASSTYPE_USE_TEMPLATE (type)
+ 	   && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (type))
  	   && TREE_CODE (decl) == TYPE_DECL
  	   && DECL_ARTIFICIAL (decl)
  	   && DECL_NAME (decl) == constructor_name (type));


More information about the Gcc-patches mailing list