aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2008-01-21 01:49:29 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2008-01-21 01:49:29 +0000
commitdbc21af5a938e0fe7ed40a3bba24555658f83eb9 (patch)
treeed3c687103842fcf2da43e11d04d5b4a2e3daa5a /gcc
parent604f825c83f937b56207bca2fc92ef9d1442a8af (diff)
downloadgcc-dbc21af5a938e0fe7ed40a3bba24555658f83eb9.zip
gcc-dbc21af5a938e0fe7ed40a3bba24555658f83eb9.tar.gz
gcc-dbc21af5a938e0fe7ed40a3bba24555658f83eb9.tar.bz2
re PR c++/34776 (ICE with invalid member declaration in template class)
/cp 2008-01-20 Paolo Carlini <pcarlini@suse.de> PR c++/34776 PR c++/34486 * name-lookup.c (do_class_using_decl): Do not call constructor_name_p on non-IS_AGGR_TYPE type scope. (constructor_name_p): Assert IS_AGGR_TYPE. /testsuite 2008-01-20 Paolo Carlini <pcarlini@suse.de> PR c++/34776 PR c++/34486 * g++.dg/template/crash75.C: New. * g++.dg/template/crash76.C: Likewise. From-SVN: r131686
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/name-lookup.c7
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/template/crash75.C8
-rw-r--r--gcc/testsuite/g++.dg/template/crash76.C13
5 files changed, 41 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 91909a1..453ad48 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2008-01-20 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/34776
+ PR c++/34486
+ * name-lookup.c (do_class_using_decl): Do not call constructor_name_p
+ on non-IS_AGGR_TYPE scope.
+ (constructor_name_p): Assert IS_AGGR_TYPE.
+
2008-01-18 Ian Lance Taylor <iant@google.com>
PR c++/33407
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 98c866f..c21940c 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -1730,13 +1730,16 @@ constructor_name (tree type)
return name;
}
-/* Returns TRUE if NAME is the name for the constructor for TYPE. */
+/* Returns TRUE if NAME is the name for the constructor for TYPE,
+ which must be a class type. */
bool
constructor_name_p (tree name, tree type)
{
tree ctor_name;
+ gcc_assert (IS_AGGR_TYPE (type));
+
if (!name)
return false;
@@ -2824,7 +2827,7 @@ do_class_using_decl (tree scope, tree name)
error ("%<%T::%D%> names destructor", scope, name);
return NULL_TREE;
}
- if (constructor_name_p (name, scope))
+ if (IS_AGGR_TYPE (scope) && constructor_name_p (name, scope))
{
error ("%<%T::%D%> names constructor", scope, name);
return NULL_TREE;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d0e0656..f45329e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-20 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/34776
+ PR c++/34486
+ * g++.dg/template/crash75.C: New.
+ * g++.dg/template/crash76.C: Likewise.
+
2008-01-20 Kaz Kojima <kkojima@gcc.gnu.org>
PR rtl-optimization/34808
diff --git a/gcc/testsuite/g++.dg/template/crash75.C b/gcc/testsuite/g++.dg/template/crash75.C
new file mode 100644
index 0000000..462be95
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash75.C
@@ -0,0 +1,8 @@
+// PR c++/34776
+
+template<typename T> struct A
+{
+ T::X<0> x; // { dg-error "non-template|T::template|base type" }
+};
+
+A<int*> a;
diff --git a/gcc/testsuite/g++.dg/template/crash76.C b/gcc/testsuite/g++.dg/template/crash76.C
new file mode 100644
index 0000000..851cdd8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash76.C
@@ -0,0 +1,13 @@
+// PR c++/34486
+
+template<typename> struct A
+{
+ typedef A* X;
+};
+
+template<typename T> struct B
+{
+ using A<T>::X::Y; // { dg-error "not a base type" }
+};
+
+B<int> b;