Commit f65e1183 by Zack Weinberg Committed by Zack Weinberg

re PR c++/7266 (pedantic segfaults on missing typename)

	PR c++/7266
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.

From-SVN: r58540
parent cd60b4b8
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> 2002-10-25 Mark Mitchell <mark@codesourcery.com>
* class.c (build_vtbl_initializer): Don't use build_vtable_entry. * class.c (build_vtbl_initializer): Don't use build_vtable_entry.
......
...@@ -11241,7 +11241,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -11241,7 +11241,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
pop_decl_namespace (); pop_decl_namespace ();
else if (friendp && (TREE_COMPLEXITY (declarator) < 2)) else if (friendp && (TREE_COMPLEXITY (declarator) < 2))
/* Don't fall out into global scope. Hides real bug? --eichin */ ; /* Don't fall out into global scope. Hides real bug? --eichin */ ;
else if (! IS_AGGR_TYPE_CODE else if (!TREE_OPERAND (declarator, 0)
|| !IS_AGGR_TYPE_CODE
(TREE_CODE (TREE_OPERAND (declarator, 0)))) (TREE_CODE (TREE_OPERAND (declarator, 0))))
; ;
else if (TREE_COMPLEXITY (declarator) == current_class_depth) else if (TREE_COMPLEXITY (declarator) == current_class_depth)
......
2002-10-25 Zack Weinberg <zack@codesourcery.com>
* g++.dg/template/typename3.C: New test.
2002-10-25 Mark Mitchell <mark@codesourcery.com> 2002-10-25 Mark Mitchell <mark@codesourcery.com>
* g++.dg/abi/vthunk2.C: New test. * g++.dg/abi/vthunk2.C: New test.
......
// { dg-do compile }
// crash test - PR 7266
template <class A>
struct B {
typedef A::C::D E; // { dg-error "no type|parse error" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment