From d0af00afb9247b0719393735c7c49996a8789013 Mon Sep 17 00:00:00 2001 From: Kriang Lerdsuwanakij Date: Thu, 1 May 2003 15:02:13 +0000 Subject: [PATCH] re PR c++/10554 (ICE with illegal using declaration) PR c++/10554 * decl2.c (do_class_using_decl): Check if operand 0 of SCOPE_REF is not NULL. * g++.dg/lookup/using5.C: New test. From-SVN: r66329 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl2.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/lookup/using5.C | 17 +++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/g++.dg/lookup/using5.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 15cca9a72ad..2f58d2eb650 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-05-01 Kriang Lerdsuwanakij + + PR c++/10554 + * decl2.c (do_class_using_decl): Check if operand 0 of SCOPE_REF + is not NULL. + 2003-05-01 Steven Bosscher * cp-tree.h (struct lang_id2): Remove. Move fields from here... diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4f0337d40f0..ec5ff717eea 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4458,6 +4458,7 @@ do_class_using_decl (tree decl) tree name, value; if (TREE_CODE (decl) != SCOPE_REF + || !TREE_OPERAND (decl, 0) || !TYPE_P (TREE_OPERAND (decl, 0))) { error ("using-declaration for non-member at class scope"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6dcbe62d272..8dc9753df90 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-05-01 Kriang Lerdsuwanakij + + PR c++/10554 + * g++.dg/lookup/using5.C: New test. + 2003-05-01 Kriang Lerdsuwanakij PR c++/8772 diff --git a/gcc/testsuite/g++.dg/lookup/using5.C b/gcc/testsuite/g++.dg/lookup/using5.C new file mode 100644 index 00000000000..0c731877270 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using5.C @@ -0,0 +1,17 @@ +// { dg-do compile } + +// Origin: Volker Reichelt + +// PR c++/10554: ICE for member using declaration with failed +// scope name lookup. + +template struct A +{ + typedef A X; + void foo(); +}; + +template struct B : A +{ + using X::foo; { dg-error "not a class-name|expected|non-member" } +};