re PR c++/34399 (ICE on invalid friend declaration of variadic template)

2008-01-15  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/34399
	* friend.c (do_friend): Don't query TYPE_BEING_DEFINED unless we
	know we have a class type.

2008-01-15  Douglas Gregor  <doug.gregor@gmail.com>

	PR c++/34399
	* g++.dg/cpp0x/vt-34399.C: New.
	* g++.dg/template/friend50.C: New.

From-SVN: r131552
This commit is contained in:
Douglas Gregor 2008-01-15 20:56:55 +00:00 committed by Doug Gregor
parent 44b962f21c
commit ac90ae18fb
5 changed files with 32 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2008-01-15 Douglas Gregor <doug.gregor@gmail.com>
PR c++/34399
* friend.c (do_friend): Don't query TYPE_BEING_DEFINED unless we
know we have a class type.
2008-01-15 Douglas Gregor <doug.gregor@gmail.com>
PR c++/34751

View file

@ -468,7 +468,7 @@ do_friend (tree ctype, tree declarator, tree decl,
the process of being defined. */
if (class_template_depth
|| COMPLETE_TYPE_P (ctype)
|| TYPE_BEING_DEFINED (ctype))
|| (CLASS_TYPE_P (ctype) && TYPE_BEING_DEFINED (ctype)))
{
if (DECL_TEMPLATE_INFO (decl))
/* DECL is a template specialization. No need to

View file

@ -1,3 +1,9 @@
2008-01-15 Douglas Gregor <doug.gregor@gmail.com>
PR c++/34399
* g++.dg/cpp0x/vt-34399.C: New.
* g++.dg/template/friend50.C: New.
2008-01-15 Douglas Gregor <doug.gregor@gmail.com>
PR c++/34751

View file

@ -0,0 +1,10 @@
// { dg-options "-std=c++0x" }
template<int...> struct A
{
void foo();
};
struct B
{
template<int N> friend void A<N>::A::foo(); // { dg-error "declared as friend" }
};

View file

@ -0,0 +1,9 @@
// PR c++/34399
template<int> struct X
{
void foo();
};
struct Y {
template<long N> friend void X<N>::X::foo(); // { dg-error "declared as friend" }
};