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
This commit is contained in:
Paolo Carlini 2008-01-21 01:49:29 +00:00 committed by Paolo Carlini
parent 604f825c83
commit dbc21af5a9
5 changed files with 41 additions and 2 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;