aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>2003-10-24 14:45:52 +0000
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>2003-10-24 14:45:52 +0000
commitd9a503018007da3173ace8c7f6a2211f8574e773 (patch)
tree0a820e98eecb9257bbb9fec1d6b3f9ab1554cc1e /gcc
parentb6d8393123f45dac768ba6da0dfd58f80074557d (diff)
downloadgcc-d9a503018007da3173ace8c7f6a2211f8574e773.zip
gcc-d9a503018007da3173ace8c7f6a2211f8574e773.tar.gz
gcc-d9a503018007da3173ace8c7f6a2211f8574e773.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/parser.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/crash13.C18
5 files changed, 33 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 536feec..0d1cd91 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 123d1a4..a053956 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 5a0c96e..9b040f5 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 720df23..7a56993 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/g++.dg/template/crash13.C b/gcc/testsuite/g++.dg/template/crash13.C
new file mode 100644
index 0000000..1d2a1f5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash13.C
@@ -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" }