view gcc/testsuite/g++.dg/cpp0x/friend1.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

// 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