On Thu, Mar 22, 2012 at 11:58 AM, Paolo Carlini <paolo.carl...@oracle.com> wrote: > On 03/22/2012 03:49 PM, Jason Merrill wrote: >> >> It's ill-formed to have a field with incomplete type. The best thing >> would be to complain about that before we get to literal_type_p so that >> errorcount is set, if that's not too complicated. > > Agreed. The problem is that if we just change check_field_decls to produce > an error about the incomplete field, we produce also another later: that is,
Can't we set a bit saying that the field has already gone through diagnostics, just like we do when trying to avoid duplicate warnings? > considering cp_parser_lambda_expression, we get to check_field_decls from > finish_struct, but we eventually also produce an error with > cxx_incomplete_type_diagnostic from build_lambda_object (-> force_rvalue -> > build_special_member_call -> complete_type_or_maybe_complain) > > Anyway, I also think not calling literal_type_p from check_field_decls if > the type is incomplete is pretty ugly, but I'm not sure which is the best > way to make progress: I could try returning a boolean from check_field_decls > if something goes wrong in order to bail out early from > cp_parser_lambda_expression (at the moment, finish_struct_1, > check_bases_and_members, all return void). Or I could try to catch the > incomplete field even *before* check_field_decls. > > What do you suggest? > > Thanks, > Paolo. >