| 1 |
// { dg-do compile } |
| 2 |
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> |
| 3 |
// DR80: Class members with same name as class |
| 4 |
|
| 5 |
struct A |
| 6 |
{ |
| 7 |
int A; |
| 8 |
}; |
| 9 |
|
| 10 |
struct A2 |
| 11 |
{ |
| 12 |
static int A2; // { dg-error "same name as" } |
| 13 |
}; |
| 14 |
|
| 15 |
|
| 16 |
template <class> |
| 17 |
struct A3 |
| 18 |
{ |
| 19 |
int A3; |
| 20 |
}; |
| 21 |
|
| 22 |
template <class> |
| 23 |
struct A4 |
| 24 |
{ |
| 25 |
static int A4; // { dg-error "same name as" } |
| 26 |
}; |
| 27 |
|
| 28 |
|
| 29 |
struct B |
| 30 |
{ |
| 31 |
B(); |
| 32 |
int B; // { dg-error "same name as" } |
| 33 |
}; |
| 34 |
|
| 35 |
struct B2 |
| 36 |
{ |
| 37 |
B2(); |
| 38 |
static int B2; // { dg-error "same name as" } |
| 39 |
}; |
| 40 |
|
| 41 |
template <class> |
| 42 |
struct B3 |
| 43 |
{ |
| 44 |
B3(); |
| 45 |
int B3; // { dg-error "same name as" "this error should appear at parsing time" { xfail *-*-* } } |
| 46 |
}; |
| 47 |
|
| 48 |
template <class> |
| 49 |
struct B4 |
| 50 |
{ |
| 51 |
B4(); |
| 52 |
static int B4; // { dg-error "same name as" } |
| 53 |
}; |