| 1 |
// { dg-do compile } |
| 2 |
// Contributed by: Michael Elizabeth Chastain |
| 3 |
// <mec dot gnu at mindspring dot com> |
| 4 |
// PR c++/13927: Wrong error message for redeclartion of type from union |
| 5 |
|
| 6 |
void foo(void) |
| 7 |
{ |
| 8 |
union { int alpha; int beta; }; // { dg-message "previous declaration" } |
| 9 |
double alpha; // { dg-error "conflicting declaration" } |
| 10 |
} |
| 11 |
|
| 12 |
// This checks both the templated version, and the position of the diagnostic |
| 13 |
// (which is currently wrong). |
| 14 |
template <int> |
| 15 |
void tfoo(void) |
| 16 |
{ |
| 17 |
union { |
| 18 |
int alpha; // { dg-error "" "" { xfail *-*-* } } |
| 19 |
int beta; |
| 20 |
}; // { dg-bogus "" "misplaced position of the declaration" { xfail *-*-* } } |
| 21 |
double alpha; // { dg-error "" } |
| 22 |
} |