mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-09 18:45:12 +08:00
parent
370df4c801
commit
e7e0c3d412
30
gcc/testsuite/g++.dg/template/friend.C
Normal file
30
gcc/testsuite/g++.dg/template/friend.C
Normal file
@ -0,0 +1,30 @@
|
||||
// Contribued by Gabriel Dos Reis <gdr@codesourcery.com>
|
||||
// Origin: iskey@i100.ryd.student.liu.se
|
||||
// { dg-do link }
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
template <class T> struct s;
|
||||
|
||||
template <class T>
|
||||
ostream& operator<<(ostream &o, const typename s<T>::t &x)
|
||||
{
|
||||
return o;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct s {
|
||||
struct t
|
||||
{
|
||||
friend ostream&
|
||||
operator<<<T>(ostream&, const typename s<T>::t &);
|
||||
};
|
||||
t x;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
s<int>::t y;
|
||||
cout << y;
|
||||
}
|
Loading…
Reference in New Issue
Block a user