OSDN Git Service

cp:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Aug 2003 09:16:16 +0000 (09:16 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Aug 2003 09:16:16 +0000 (09:16 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70803 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 692937e..7079968 100644 (file)
@@ -1,5 +1,9 @@
 2003-08-26  Nathan Sidwell  <nathan@codesourcery.com>
 
 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
        * 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 d89ec91..0f6d090 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)))
            {
          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;
            }
              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;
        }
       else if (TREE_CODE (x) == OVERLOAD && is_overloaded_fn (bval))
        old_decl = bval;
index 608a27c..200a4e3 100644 (file)
@@ -1,5 +1,8 @@
 2003-08-26  Nathan Sidwell  <nathan@codesourcery.com>
 
 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>
        * 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;;);
+}
+