]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/3761 (ICE in check_template_shadow, at cp/pt.c:2013, with friend and strang...
authorScott Brumbaugh <scottb.lists@verizon.net>
Sat, 3 Jul 2004 02:19:27 +0000 (02:19 +0000)
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>
Sat, 3 Jul 2004 02:19:27 +0000 (02:19 +0000)
PR c++/3761
* name-lookup.c (push_class_level_binding): Don't pass a
TREE_LIST of ambiguous names to check_template_shadow as it
only handles declarations. Instead, pull the declaration
out and pass that.

PR c++/3761
* g++.dg/lookup/crash4.C: New test.

From-SVN: r84045

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/crash4.C [new file with mode: 0644]

index cd5dc6644bd19ea148390f0f9d80b85c943db20c..8baadc015a2d83f654dc14e28cd86a1d859d08a7 100644 (file)
@@ -1,3 +1,11 @@
+2004-07-03  Scott Brumbaugh  <scottb.lists@verizon.net>\r
+\r
+       PR c++/3761\r
+       * name-lookup.c (push_class_level_binding): Don't pass a\r
+       TREE_LIST of ambiguous names to check_template_shadow as it\r
+       only handles declarations. Instead, pull the declaration \r
+       out and pass that.\r
+
 2004-07-03  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
        PR c++/14971
index e449631fdec2eff2b6583e05e30815bc26516cac..ef1668938d58a89ffd091524bfa860bce71646fa 100644 (file)
@@ -2777,7 +2777,18 @@ push_class_level_binding (tree name, tree x)
   /* Make sure that this new member does not have the same name
      as a template parameter.  */
   if (TYPE_BEING_DEFINED (current_class_type))
-    check_template_shadow (x);
+    {
+      tree decl = x;
+
+      /* We could have been passed a tree list if this is an ambiguous
+        declaration. If so, pull the declaration out because
+        check_template_shadow will not handle a TREE_LIST. */
+      if (TREE_CODE (decl) == TREE_LIST 
+         && TREE_TYPE (decl) == error_mark_node)
+       decl = TREE_VALUE (decl);
+      
+      check_template_shadow (decl);
+    }
 
   /* [class.mem]
 
index 2ba74a1b3dd0540cccb305a8545870c782347801..cc8bd6e0c4ae5fedd18ba06dc21a405f8409b73f 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-03  Scott Brumbaugh  <scottb.lists@verizon.net>\r
+\r
+       PR c++/3761\r
+       * g++.dg/lookup/crash4.C: New test.\r
+
 2004-07-02  Zack Weinberg  <zack@codesourcery.com>
 
        * gcc.c-torture/execute/builtin-abs-1.c
diff --git a/gcc/testsuite/g++.dg/lookup/crash4.C b/gcc/testsuite/g++.dg/lookup/crash4.C
new file mode 100644 (file)
index 0000000..6568651
--- /dev/null
@@ -0,0 +1,18 @@
+// { dg-do compile }
+//
+// PR 3761
+
+struct A {};
+
+struct B {};
+
+template <class T>
+struct Foo : A, B
+{
+  void func(void);
+
+  struct Nested
+  {
+    friend void Foo::func(void);
+  };
+};