This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] PR 58664


Hi,

On 05/20/2014 04:50 AM, Jason Merrill wrote:
On 05/19/2014 06:43 PM, Paolo Carlini wrote:
          if (unqualified_id)
-          error ("field %qD has incomplete type %qT",
-             unqualified_id, type);
+          cxx_incomplete_type_error (unqualified_id, type);
          else
            error ("name %qT has incomplete type", type);

Why not use cxx_incomplete_type_error in both cases?
In fact, my patch has a rather serious issue: the use of cxx_incomplete_type_error means that we don't print anymore the name of the field in the non-template case because we don't have yet a FIELD_DECL yet, we have an IDENTIFIER_NODE. I think this is a regression, in particular as long as our locations aren't always perfect or the user decides to disable the caret.

Then, about your specific point, I don't think the additional inform facility automatically provided by cxx_incomplete_type_error is normally useful in the !unqualified_id case: if you consider, for example, parse/crash31.C below, clang++ also doesn't print any notes in such cases. Then I think we can as well leave that error alone (and consistent with the other error)

Thanks,
Paolo.

PS: note that initialized doesn't play any role in the unqualified_id case: either we don't have an array at all or its element-type is incomplete, eg:

struct S
{
  int a[];
};

is simply accepted of course (COMPLETE_TYPE_P (complete_type (type)) is true).

//////////////////////

Attachment: CL_58664_c
Description: Text document

Attachment: patch_58664_c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]