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: [PATCH] Fix PR c++/92024


Ping...

for the c++ FE and testsuite changes in the updated patch
here: https://gcc.gnu.org/ml/gcc-patches/2019-10/msg00916.html


Thanks
Bernd.




On 10/12/19 8:10 PM, Bernd Edlinger wrote:
> On 10/11/19 6:31 PM, Jason Merrill wrote:
>> On 10/10/19 2:06 PM, Bernd Edlinger wrote:
>>> On 10/10/19 7:49 PM, Jason Merrill wrote:
>>>
>>> if -Wshadow=compatible-local is used, the can_convert function crashes
>>> in instantiate_class_template_1.
>>
>> Right, checking can_convert is problematic here, as it can cause template instantiations that change the semantics of the program.  Or, in this case, crash.
>>
> 
> So I try to make C++ behave more consistently with the code in c-decl.c,
> thus dependent on warn_shadow but not on warn_shadow_local and/or
> warn_shadow_compatible_local:
> 
>            if (warn_shadow)
>               warning_code = OPT_Wshadow;
>             else if (comptypes (TREE_TYPE (old_decl), TREE_TYPE (new_decl)))
>               warning_code = OPT_Wshadow_compatible_local;
>             else
>               warning_code = OPT_Wshadow_local;
>             warned = warning_at (DECL_SOURCE_LOCATION (new_decl), warning_code,
>                                  "declaration of %qD shadows a parameter",
>                                  new_decl);
> 
> I cannot remove the if (warn_shadow) since this breaks gcc.dg/pr48062.c
> which uses:
> 
> #pragma GCC diagnostic ignored "-Wshadow"
> 
> to disable a -Wshadow=compatible-local warning, but while -Wno-shadow on the
> command line disables also dependent warnings the pragma does not (always) do that.
> 
> So instead I'd like to adjust the doc of -Wshadow to reflect the implementation
> and remove the if(warn_shadow_local) to have C and C++ behave identical and
> hopefully now in sync with the doc.
> 
> 
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
> 
> 
> Thanks
> Bernd.
> 


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