Hi,

On 28/11/18 19:05, Marek Polacek wrote:
Paolo's recent commit changed

-         pedwarn (input_location, OPT_Wpedantic,
+         pedwarn (declarator->id_loc, OPT_Wpedantic,

but as this testcase shows, declarator might not always be present.  So
let's brace ourselves for that.

Thanks Marek. Just to clarify a bit more, ultimately the reason why I missed this case is that, when the declarator is null - for the testcase at issue, that is - we end up printing something of the form:

warning: ISO C++ forbids flexible array member ‘type name’

thus, all in all, I'm wondering if it wouldn't be a tad less cryptic to do something like the attached., which avoids printing "type name".

Cheers, Paolo.

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


Index: decl.c
===================================================================
--- decl.c      (revision 266555)
+++ decl.c      (working copy)
@@ -12221,7 +12219,7 @@ grokdeclarator (const cp_declarator *declarator,
                if (in_system_header_at (input_location))
                  /* Do not warn on flexible array members in system
                     headers because glibc uses them.  */;
-               else if (name)
+               else if (name && declarator)
                  pedwarn (declarator->id_loc, OPT_Wpedantic,
                           "ISO C++ forbids flexible array member %qs", name);
                else

Reply via email to