summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/parse/friend7.C
blob: 668fd35d37cc2d8b9725751e669c8b74fd2797bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// PR c++/34488
// { dg-do compile }

struct A
{
  A ();
  ~A ();
  A (const A &);
};

struct B
{
  friend A::A ();
  friend A::~A ();
  friend A::A (const A &);
};

struct C
{
  friend int C ();		// { dg-error "return type|in friend decl" }
  friend int ~C ();		// { dg-error "return type|in friend decl" }
  friend int C (const C &);	// { dg-error "return type|in friend decl" }
};

struct D
{
  friend int D () {}		// { dg-error "return type|in friend decl" }
  friend int ~D () {}		// { dg-error "return type|in friend decl" }
  friend int D (const D &) {}	// { dg-error "return type|in friend decl" }
};

struct E
{
  friend A::A () {}		// { dg-error "cannot define member" }
  friend A::~A () {}		// { dg-error "cannot define member" }
  friend A::A (const A &) {}	// { dg-error "cannot define member" }
};