PR c++/7266
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 Oct 2002 22:01:44 +0000 (22:01 +0000)
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 Oct 2002 22:01:44 +0000 (22:01 +0000)
cp:
* decl.c (grokdeclarator): Check that TREE_OPERAND 0 of a
SCOPE_REF is not null before dereferencing it.
testsuite:
* g++.dg/template/typename3.C: New test.

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

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

index 35251df..03a13c1 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-25  Zack Weinberg  <zack@codesourcery.com>
+
+       PR c++/7266
+       * decl.c (grokdeclarator): Check that TREE_OPERAND 0 of a
+       SCOPE_REF is not null before dereferencing it.
+
 2002-10-25  Mark Mitchell  <mark@codesourcery.com>
 
        * class.c (build_vtbl_initializer): Don't use build_vtable_entry.
@@ -8,7 +14,7 @@
        * decl.c (duplicate_decls): Copy it.
        * method.c (make_thunk): Simplify, and add thunks to DECL_THUNKS.
        * semantics.c (emit_associated_thunks): Simplify.
-       
+
 2002-10-24  David Edelsohn  <edelsohn@gnu.org>
 
        PR c++/7228
index 7459c87..3e1c215 100644 (file)
@@ -11241,8 +11241,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
              pop_decl_namespace ();
            else if (friendp && (TREE_COMPLEXITY (declarator) < 2))
              /* Don't fall out into global scope. Hides real bug? --eichin */ ;
-           else if (! IS_AGGR_TYPE_CODE
-                    (TREE_CODE (TREE_OPERAND (declarator, 0))))
+           else if (!TREE_OPERAND (declarator, 0)
+                    || !IS_AGGR_TYPE_CODE
+                         (TREE_CODE (TREE_OPERAND (declarator, 0))))
              ;
            else if (TREE_COMPLEXITY (declarator) == current_class_depth)
              {
index a073e68..e6874ec 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-25  Zack Weinberg  <zack@codesourcery.com>
+
+       * g++.dg/template/typename3.C: New test.
+
 2002-10-25  Mark Mitchell  <mark@codesourcery.com>
 
        * g++.dg/abi/vthunk2.C: New test.
@@ -27,7 +31,7 @@
 
        PR c++/7679
        * g++.dg/parse/inline1.C: New test.
-       
+
 2002-10-23  Richard Henderson  <rth@redhat.com>
 
        * g++.dg/inherit/thunk1.C: Enable for x86_64.
diff --git a/gcc/testsuite/g++.dg/template/typename3.C b/gcc/testsuite/g++.dg/template/typename3.C
new file mode 100644 (file)
index 0000000..1c573ba
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-do compile }
+// crash test - PR 7266
+
+template <class A>
+struct B {
+ typedef A::C::D E;  // { dg-error "no type|parse error" }
+};