| 1 |
// PR c++/118319 - With -fpermissive |
| 2 |
// { dg-do "compile" { target c++11 } } |
| 3 |
// { dg-additional-options "-fpermissive" } |
| 4 |
|
| 5 |
// Template case, that used to crash. |
| 6 |
// Check that we error-out even with -fpermissive. |
| 7 |
|
| 8 |
template <int> |
| 9 |
struct S { // { dg-error "instantiating erroneous template" } |
| 10 |
friend void foo1 (int a = []{}()); // { dg-warning "specifies default|only declaration" } |
| 11 |
}; |
| 12 |
|
| 13 |
void foo1 (int a) {} |
| 14 |
|
| 15 |
void hello (){ |
| 16 |
S<0> t; |
| 17 |
foo1 (); |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
// Non template case, that already worked. |
| 22 |
// Check that errors are demoted to warnings. |
| 23 |
|
| 24 |
struct NoTemplate { |
| 25 |
friend void baz (int a = 1); // { dg-warning "specifies default" } |
| 26 |
}; |
| 27 |
|
| 28 |
void baz (int a) {} // { dg-warning "only declaration" } |
| 29 |
|
| 30 |
void ola (){ |
| 31 |
NoTemplate t; |
| 32 |
baz (); |
| 33 |
} |