| 1 |
// PR c++/24449 |
| 2 |
|
| 3 |
class Fooa |
| 4 |
{ |
| 5 |
friend int main(); |
| 6 |
}; |
| 7 |
|
| 8 |
template <class T> class Foob |
| 9 |
{ |
| 10 |
friend int main(); |
| 11 |
int i; |
| 12 |
}; |
| 13 |
|
| 14 |
int main() |
| 15 |
{ |
| 16 |
Foob<void> a; |
| 17 |
a.i = 7; |
| 18 |
} |
| 19 |
|
| 20 |
class Fooc |
| 21 |
{ |
| 22 |
template<class T> friend int main(); // { dg-error "cannot declare .::main. to be a template" } |
| 23 |
}; |
| 24 |
|
| 25 |
template<class T> class Food |
| 26 |
{ |
| 27 |
template<class U> friend int main(); // { dg-error "cannot declare .::main. to be a template" } |
| 28 |
}; |
| 29 |
|
| 30 |
template<class U> int main() {} // { dg-error "cannot declare .::main. to be a template" } |