From: Kriang Lerdsuwanakij Date: Fri, 24 Oct 2003 14:45:52 +0000 (+0000) Subject: re PR c++/11076 (ICE with invalid base class) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d9a503018007da3173ace8c7f6a2211f8574e773;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 536feec51ed..0d1cd9173ad 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2003-10-24 Kriang Lerdsuwanakij + + 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 PR c++/12698, c++/12699, c++/12700, c++/12566 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 123d1a4ea0f..a053956ad9a 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -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; } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 5a0c96ebf9e..9b040f557d0 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 720df2382d5..7a56993777c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-10-24 Kriang Lerdsuwanakij + + PR c++/11076 + * g++.dg/template/crash13.C: New test. + 2003-10-24 Joseph S. Myers * gcc.dg/c99-restrict-2.c: New test. diff --git a/gcc/testsuite/g++.dg/template/crash13.C b/gcc/testsuite/g++.dg/template/crash13.C new file mode 100644 index 00000000000..1d2a1f5dde0 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash13.C @@ -0,0 +1,18 @@ +// { dg-do compile } + +// Origin: Volker Reichelt + +// PR c++/11076: ICE for invalid access declaration containing typename. + +template struct A +{ + typedef A B; +}; + +template struct C +{ // { dg-error "not a base type" } + typedef typename A::B X; + X::Y; +}; + +C c; // { dg-error "instantiated" }