3 // by Alexandre Oliva <oliva@dcc.unicamp.br>
5 // I'm not 100% sure this program is correct, but g++ shouldn't just
8 // The idea is to give privileged access to bar<A> only to
9 // specializations foo<A,B>, for all B.
11 template <class A, class B> void foo();
12 template <class C> class bar {
13 int i; // { dg-error "" } private
14 template <class B> friend void foo<C,B>(); // { dg-error "" } bogus declaration
16 template <class A, class B> void foo() {
17 bar<A> baz; baz.i = 1; // { dg-error "" } foo cannot access bar<int>::i
18 bar<int> buz; buz.i = 1; // { dg-error "" } foo cannot access bar<int>::i