view gcc/testsuite/g++.dg/parse/friend-main.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

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