re PR c++/11076 (ICE with invalid base class)

PR c++/11076
	* class.c (handle_using_decl): Swap arguments of error_not_base_type.
	* parser.c (cp_parser_direct_declarator): Only resolve typename for
	namespace scope declarations.

	* g++.dg/template/crash13.C: New test.

From-SVN: r72897
This commit is contained in:
Kriang Lerdsuwanakij 2003-10-24 14:45:52 +00:00 committed by Kriang Lerdsuwanakij
parent b6d8393123
commit d9a5030180
5 changed files with 33 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2003-10-24 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/11076
* class.c (handle_using_decl): Swap arguments of error_not_base_type.
* parser.c (cp_parser_direct_declarator): Only resolve typename for
namespace scope declarations.
2003-10-24 Nathan Sidwell <nathan@codesourcery.com>
PR c++/12698, c++/12699, c++/12700, c++/12566

View File

@ -1109,7 +1109,7 @@ handle_using_decl (tree using_decl, tree t)
binfo = lookup_base (t, ctype, ba_any, NULL);
if (! binfo)
{
error_not_base_type (t, ctype);
error_not_base_type (ctype, t);
return;
}

View File

@ -9871,7 +9871,8 @@ cp_parser_direct_declarator (cp_parser* parser,
if (declarator == error_mark_node)
break;
if (TREE_CODE (declarator) == SCOPE_REF)
if (TREE_CODE (declarator) == SCOPE_REF
&& !current_scope ())
{
tree scope = TREE_OPERAND (declarator, 0);

View File

@ -1,3 +1,8 @@
2003-10-24 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/11076
* g++.dg/template/crash13.C: New test.
2003-10-24 Joseph S. Myers <jsm@polyomino.org.uk>
* gcc.dg/c99-restrict-2.c: New test.

View File

@ -0,0 +1,18 @@
// { dg-do compile }
// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
// PR c++/11076: ICE for invalid access declaration containing typename.
template<typename, typename T=void> struct A
{
typedef A<T,T> B;
};
template <typename T> struct C
{ // { dg-error "not a base type" }
typedef typename A<T>::B X;
X::Y;
};
C<void> c; // { dg-error "instantiated" }