[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    [C++ PATCH, committed] Fix PR9432,9528 (Trunk regression)
From:       Kriang Lerdsuwanakij <lerdsuwa () users ! sourceforge ! net>
Date:       2003-04-30 17:57:37
[Download RAW message or body]

Hi

This patch fixes the regressions PR9432, PR9528 in the trunk.
validate_nonmember_using_decl fails to handle using declarations 
that contains dependent name in its scope and ICE in the
my_friendly_assert test.

Patch committed to trunk as obvious.  Tested on i686-pc-linux-gnu.

--Kriang


2003-04-30  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	PR c++/9432, c++/9528
	* decl2.c (validate_nonmember_using_decl): Handle SCOPE_REF.

2003-04-30  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	PR c++/9432, c++/9528
	* g++.dg/lookup/using4.C: New test.


diff -cprN gcc-main-save/gcc/cp/decl2.c gcc-main-new/gcc/cp/decl2.c
*** gcc-main-save/gcc/cp/decl2.c	Sun Apr 27 19:10:57 2003
--- gcc-main-new/gcc/cp/decl2.c	Wed Apr 30 23:47:50 2003
*************** validate_nonmember_using_decl (tree decl
*** 4236,4241 ****
--- 4236,4249 ----
        return NULL_TREE;
      }
  
+   if (TREE_CODE (decl) == SCOPE_REF)
+     {
+       /* It's a nested name with template parameter dependent scope.
+ 	 This can only be using-declaration for class member.  */
+       error ("`%T' is not a namespace", TREE_OPERAND (decl, 0));
+       return NULL_TREE;
+     }
+ 
    if (is_overloaded_fn (decl))
      decl = get_first_fn (decl);
  
diff -cprN gcc-main-save/gcc/testsuite/g++.dg/lookup/using4.C \
                gcc-main-new/gcc/testsuite/g++.dg/lookup/using4.C
*** gcc-main-save/gcc/testsuite/g++.dg/lookup/using4.C	Thu Jan  1 07:00:00 1970
--- gcc-main-new/gcc/testsuite/g++.dg/lookup/using4.C	Wed Apr 30 23:51:15 2003
***************
*** 0 ****
--- 1,15 ----
+ // { dg-do compile }
+ 
+ // Origin: Richard Guenther <rguenth@tat.physik.uni-tuebingen.de>
+ 
+ // PR c++/9432: ICE in validate_nonmember_using_decl when decl is a 
+ // SCOPE_REF.
+ 
+ template <class T> struct Foo;
+ template <class T>
+ struct Bar : public Foo<T> {
+         void foo()
+         {
+                 using Foo<T>::i;	// { dg-error "not a namespace" }
+         }
+ };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic