backport: re PR c++/41305 (Infinite recursion with g++ at -O0)

2009-12-28  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-12-24  Jason Merrill  <jason@redhat.com>

	PR c++/41305
	* g++.dg/lookup/koenig10.C: New test.
	* g++.dg/lookup/koenig11.C: New test.
	* g++.dg/lookup/koenig12.C: New test.

From-SVN: r155491
This commit is contained in:
H.J. Lu 2009-12-28 17:18:22 +00:00 committed by H.J. Lu
parent c1f3b5d1d9
commit 83f8267169
4 changed files with 52 additions and 0 deletions

View File

@ -1,3 +1,13 @@
2009-12-28 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline:
2009-12-24 Jason Merrill <jason@redhat.com>
PR c++/41305
* g++.dg/lookup/koenig10.C: New test.
* g++.dg/lookup/koenig11.C: New test.
* g++.dg/lookup/koenig12.C: New test.
2009-12-28 H.J. Lu <hongjiu.lu@intel.com>
Backport from mainline:

View File

@ -0,0 +1,12 @@
// Test for proper handling of class-scope enums.
struct A
{
enum E { e };
friend void f (E);
};
int main()
{
f(A::e);
}

View File

@ -0,0 +1,12 @@
// Test that we treat unions like other classes in arg-dep lookup.
union U
{
friend void f (U);
};
int main()
{
U u;
f(u);
}

View File

@ -0,0 +1,18 @@
// PR c++/41305
// We got into infinite recursion instantiating the B<U> series.
template <class T> struct A { };
template <class T, class U = A<T> > struct B;
template <class T> struct C { };
template <class T, class U> struct B: C<B<U> >
{
friend void f(B) { }
};
B<int> b;
int main()
{
f(b);
}