"field %0 declared as a function")
DIAG(err_field_incomplete, ERROR,
"field has incomplete type %0")
-DIAG(err_variable_sized_type_in_struct, ERROR,
- "variable sized type %0 must be at end of struct or class")
+DIAG(ext_variable_sized_type_in_struct, EXTWARN,
+ "variable sized type %0 not at the end of a struct or class is a "
+ "GNU extension")
DIAG(err_flexible_array_empty_struct, ERROR,
"flexible array %0 not allowed in otherwise empty struct")
DIAG(ext_flexible_array_in_struct, EXTENSION,
// If this is a struct/class and this is not the last element, reject
// it. Note that GCC supports variable sized arrays in the middle of
// structures.
- if (i != NumFields-1) {
- Diag(FD->getLocation(), diag::err_variable_sized_type_in_struct)
+ if (i != NumFields-1)
+ Diag(FD->getLocation(), diag::ext_variable_sized_type_in_struct)
<< FD->getDeclName();
- FD->setInvalidDecl();
- EnclosingDecl->setInvalidDecl();
- continue;
+ else {
+ // We support flexible arrays at the end of structs in
+ // other structs as an extension.
+ Diag(FD->getLocation(), diag::ext_flexible_array_in_struct)
+ << FD->getDeclName();
+ if (Record)
+ Record->setHasFlexibleArrayMember(true);
}
- // We support flexible arrays at the end of structs in other structs
- // as an extension.
- Diag(FD->getLocation(), diag::ext_flexible_array_in_struct)
- << FD->getDeclName();
- if (Record)
- Record->setHasFlexibleArrayMember(true);
}
}
}