diff options
author | Jason Merrill <jason@redhat.com> | 2009-12-24 16:46:14 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-12-24 16:46:14 -0500 |
commit | db10df3dfcd9eec5bc477bf3ec689e62f8c12db5 (patch) | |
tree | c487a6204121c71d9afe1c113f2b34f12c97fdc5 /gcc/testsuite | |
parent | 17fad3611f3624776fc617e7734a80f7abba0562 (diff) | |
download | gcc-db10df3dfcd9eec5bc477bf3ec689e62f8c12db5.zip gcc-db10df3dfcd9eec5bc477bf3ec689e62f8c12db5.tar.gz gcc-db10df3dfcd9eec5bc477bf3ec689e62f8c12db5.tar.bz2 |
PR c++/41305, DR 384
PR c++/41305, DR 384
* name-lookup.c (arg_assoc_class): Split out arg_assoc_class_only
and arg_assoc_bases.
(friend_of_associated_class_p): Remove.
(arg_assoc_namespace): Don't call it.
(arg_assoc_template_arg): Use arg_assoc_class_only for member
template context.
(arg_assoc_type): Handle UNION_TYPE and ENUMERAL_TYPE properly.
* name-lookup.c (arg_assoc): Handle TEMPLATE_ID_EXPR properly.
From-SVN: r155461
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/koenig10.C | 12 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/koenig11.C | 12 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/koenig12.C | 18 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/koenig9.C | 25 |
5 files changed, 75 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f2d8927..14bc7b7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2009-12-24 Jason Merrill <jason@redhat.com> + + PR c++/41305 + * g++.dg/lookup/koenig9.C: New test. + * g++.dg/lookup/koenig10.C: New test. + * g++.dg/lookup/koenig11.C: New test. + * g++.dg/lookup/koenig12.C: New test. + 2009-12-24 Julian Brown <julian@codesourcery.com> Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> diff --git a/gcc/testsuite/g++.dg/lookup/koenig10.C b/gcc/testsuite/g++.dg/lookup/koenig10.C new file mode 100644 index 0000000..f2fce9c --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/koenig10.C @@ -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); +} diff --git a/gcc/testsuite/g++.dg/lookup/koenig11.C b/gcc/testsuite/g++.dg/lookup/koenig11.C new file mode 100644 index 0000000..dab853b --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/koenig11.C @@ -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); +} diff --git a/gcc/testsuite/g++.dg/lookup/koenig12.C b/gcc/testsuite/g++.dg/lookup/koenig12.C new file mode 100644 index 0000000..c135899 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/koenig12.C @@ -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); +} diff --git a/gcc/testsuite/g++.dg/lookup/koenig9.C b/gcc/testsuite/g++.dg/lookup/koenig9.C new file mode 100644 index 0000000..f867a32 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/koenig9.C @@ -0,0 +1,25 @@ +// Test for sensible handling of template-ids with arg-dep lookup. +// This is still an open issue. + +namespace N +{ + struct A { }; + void f(void (*)(int, N::A)); +} + +namespace M +{ + struct B { }; + void f(void (*)(B, N::A)); +} + +template <class T> +void g(T, N::A); + +void g(); + +int main() +{ + f(g<int>); + f(g<M::B>); +} |