aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/friend1.C
blob: ae2c603aa8bfaaed324abd70614646560ca60d1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// From N1791
// { dg-do compile { target c++11 } }

class C;
typedef C Ct;
class X1 {
  friend C;		// OK: class C is a friend
};

class X2
{
  friend Ct;		// OK: class C is a friend
  friend D;		// { dg-error "" } no type-name D in scope
  friend class D;	// OK: elaborated-type-specifier declares new class
};

template <typename T> class R {
  friend T;
};

R<C> rc;		// class C is a friend of R<C>
R<int> Ri;		// OK: "friend int;" is ignored