summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/g++.dg/parse/friend-main.C
blob: e6d32e71ba47c958383761f3b0a4ae1ed532673a (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
// PR c++/24449

class Fooa
{
  friend int main();
};

template <class T> class Foob
{
  friend int main();
  int i;
};

int main()
{
  Foob<void> a;
  a.i = 7;
}

class Fooc
{
  template<class T> friend int main(); // { dg-error "cannot declare .::main. to be a template" }
};

template<class T> class Food
{
  template<class U> friend int main(); // { dg-error "cannot declare .::main. to be a template" }
};

template<class U> int main() {} // { dg-error "cannot declare .::main. to be a template" }
OpenPOWER on IntegriCloud