re PR c++/11871 (Koenig lookup regression)
authorNathan Sidwell <nathan@codesourcery.com>
Tue, 26 Aug 2003 09:16:16 +0000 (09:16 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Tue, 26 Aug 2003 09:16:16 +0000 (09:16 +0000)
cp:
PR c++/11871
* decl.c (push_class_level_binding): Correct old_decl value from
my 2003-07-29 reorganization.
testsuite:
PR c++/11871
* c++.dg/lookup/crash1.C: New test.

From-SVN: r70803

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

index 692937ea36aeecc84743805fee0318053b60ffc7..7079968f99073ec267a9dbf00752f34dffdadc2f 100644 (file)
@@ -1,5 +1,9 @@
 2003-08-26  Nathan Sidwell  <nathan@codesourcery.com>
 
+       PR c++/11871
+       * decl.c (push_class_level_binding): Correct old_decl value from
+       my 2003-07-29 reorganization.
+
        * call.c (build_call): Don't set TREE_SIDE_EFFECTS here.
        (build_new_method_call): Add goto finish.
        * semantics.c (simplify_aggr_init_exprs_r): Don't set
index d89ec9161c65d181c2bf0a6c34c089616f210337..0f6d09061b8bd3f62895da3b08e028242c16b926 100644 (file)
@@ -4282,11 +4282,13 @@ push_class_level_binding (tree name, tree x)
          if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval)
              && !(TREE_CODE (x) == TYPE_DECL && DECL_ARTIFICIAL (x)))
            {
+             old_decl = BINDING_TYPE (binding);
              BINDING_TYPE (binding) = bval;
              BINDING_VALUE (binding) = NULL_TREE;
              INHERITED_VALUE_BINDING_P (binding) = 0;
            }
-         old_decl = bval;
+         else
+           old_decl = bval;
        }
       else if (TREE_CODE (x) == OVERLOAD && is_overloaded_fn (bval))
        old_decl = bval;
index 608a27c7d1f9e8d66247b2c5f7be2dab63a67097..200a4e38d466ad112c834e4d3606712b85d5dd2f 100644 (file)
@@ -1,5 +1,8 @@
 2003-08-26  Nathan Sidwell  <nathan@codesourcery.com>
 
+       PR c++/11871
+       * c++.dg/lookup/crash1.C: New test.
+
        * c++.dg/warn/noeffect3.C: New test.
 
 2003-08-25  Janis Johnson  <janis187@us.ibm.com>
diff --git a/gcc/testsuite/g++.dg/lookup/crash1.C b/gcc/testsuite/g++.dg/lookup/crash1.C
new file mode 100644 (file)
index 0000000..cd90685
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 25 Aug 2003 <nathan@codesourcery.com>
+// Origin pr 11871 Dirk Mueller <mueller@kde.org>
+
+// PR c++/11871 Regression
+
+namespace std
+{
+  class A
+  {
+  public:
+    enum result
+    {
+      ok
+    };
+  };
+
+  template<typename T> class B : public A
+    {
+    public:
+      typedef A::result        result;
+    };
+}
+
+int main()
+{
+  for(float result = 1.0;;);
+}
+