| 1 |
// PR c++/89390 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-fdiagnostics-show-caret" } |
| 4 |
|
| 5 |
enum class bar { A, B, C }; |
| 6 |
|
| 7 |
void |
| 8 |
foo () |
| 9 |
{ |
| 10 |
bar::~bar (); // { dg-error "8: '~bar' is not a member of 'bar'" } |
| 11 |
/* { dg-begin-multiline-output "" } |
| 12 |
bar::~bar (); |
| 13 |
^~~~ |
| 14 |
{ dg-end-multiline-output "" } */ |
| 15 |
} |
| 16 |
|
| 17 |
namespace ns { enum class baz { P, Q, R }; } |
| 18 |
|
| 19 |
void |
| 20 |
test_2 () |
| 21 |
{ |
| 22 |
ns::baz::~baz (); // { dg-error "12: '~ns::baz' is not a member of 'ns::baz'" } |
| 23 |
/* { dg-begin-multiline-output "" } |
| 24 |
ns::baz::~baz (); |
| 25 |
^~~~ |
| 26 |
{ dg-end-multiline-output "" } */ |
| 27 |
} |
| 28 |
|
| 29 |
struct first; |
| 30 |
struct second; |
| 31 |
second::~first() {} // { dg-error "9: declaration of '~first' as member of 'second'" } |
| 32 |
/* { dg-begin-multiline-output "" } |
| 33 |
second::~first() {} |
| 34 |
^~~~~~ |
| 35 |
{ dg-end-multiline-output "" } */ |
| 36 |
|
| 37 |
struct test { ~test(); }; |
| 38 |
typedef test test_t; |
| 39 |
~test_t(); // { dg-error "typedef-name 'test_t' used as destructor declarator" } |
| 40 |
// { dg-error "expected" "" { target *-*-* } .-1 } |
| 41 |
/* { dg-begin-multiline-output "" } |
| 42 |
~test_t(); |
| 43 |
^~~~~~~ |
| 44 |
{ dg-end-multiline-output "" } */ |
| 45 |
/* { dg-begin-multiline-output "" } |
| 46 |
~test_t(); |
| 47 |
^ |
| 48 |
{ dg-end-multiline-output "" } */ |