| 1 |
// PR c++/118306 - "Document" various behaviours wrt. defaulting types to int. |
| 2 |
// { dg-do "compile" } |
| 3 |
// { dg-additional-options "-fpermissive" } |
| 4 |
|
| 5 |
// Members. |
| 6 |
struct K { |
| 7 |
* mem1; // { dg-warning "forbids declaration" } |
| 8 |
* mem2; // { dg-warning "forbids declaration" } |
| 9 |
const * mem3; // { dg-warning "forbids declaration" } |
| 10 |
const ** mem4; // { dg-warning "forbids declaration" } |
| 11 |
& mem5; // { dg-warning "forbids declaration" } |
| 12 |
volatile & mem6; // { dg-warning "forbids declaration" } |
| 13 |
|
| 14 |
void foo (const& permissive_fine, // { dg-warning "forbids declaration" } |
| 15 |
volatile* permissive_fine_as_well); // { dg-warning "forbids declaration" } |
| 16 |
|
| 17 |
* bar () { return 0; } // { dg-warning "forbids declaration" } |
| 18 |
const& baz (); // { dg-warning "forbids declaration" } |
| 19 |
|
| 20 |
void bazz () { |
| 21 |
try {} |
| 22 |
catch (const *i) {} // { dg-warning "forbids" } |
| 23 |
catch (const &i) {} // { dg-warning "forbids" } |
| 24 |
} |
| 25 |
}; |
| 26 |
|
| 27 |
// Template parameters. |
| 28 |
template<const *i, const &j> // { dg-warning "forbids" } |
| 29 |
void baz() {} |
| 30 |
|
| 31 |
// Functions. |
| 32 |
foo(int) { return 42; } // { dg-warning "forbids declaration" } |
| 33 |
*bar(int) { return 0; } // { dg-warning "forbids declaration" } |
| 34 |
**bazz(int) { return 0; } // { dg-warning "forbids declaration" } |
| 35 |
*&bazzz(int) { return 0; } // { dg-warning "forbids declaration|bind non-const" } |
| 36 |
const bazzzz (int) { return 0; } // { dg-warning "forbids declaration" } |
| 37 |
const* bazzzzz (int) { return 0; } // { dg-warning "forbids declaration" } |