On Fri, Oct 11, 2019 at 12:58:41PM +0200, Paolo Carlini wrote:
> Hi,
> 
> another straightforward DECL_SOURCE_LOCATION (TYPE_MAIN_DECL consistent with
> the one I used in build_anon_union_vars. Tested x86_64-linux.
> 
> Thanks, Paolo.
> 
> /////////////////////

> /cp
> 2019-10-11  Paolo Carlini  <paolo.carl...@oracle.com>
> 
>       * decl.c (check_tag_decl): Use DECL_SOURCE_LOCATION.
> 
> /testsuite
> 2019-10-11  Paolo Carlini  <paolo.carl...@oracle.com>
> 
>       * g++.dg/cpp0x/constexpr-union5.C: Test location(s) too.
>       * g++.dg/diagnostic/bitfld2.C: Likewise.
>       * g++.dg/ext/anon-struct1.C: Likewise.
>       * g++.dg/ext/anon-struct6.C: Likewise.
>       * g++.dg/ext/flexary19.C: Likewise.
>       * g++.dg/ext/flexary9.C: Likewise.
>       * g++.dg/template/error17.C: Likewise.

> Index: cp/decl.c
> ===================================================================
> --- cp/decl.c (revision 276845)
> +++ cp/decl.c (working copy)
> @@ -4992,7 +4992,8 @@ check_tag_decl (cp_decl_specifier_seq *declspecs,
>  
>        if (TREE_CODE (declared_type) != UNION_TYPE
>         && !in_system_header_at (input_location))
> -     pedwarn (input_location, OPT_Wpedantic, "ISO C++ prohibits anonymous 
> structs");
> +     pedwarn (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (declared_type)),
> +              OPT_Wpedantic, "ISO C++ prohibits anonymous structs");

The change looks fine but the in_system_header_at line can be dropped, right?

Marek

Reply via email to