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 c++/57709] Wshadow is too strict / has false positives


On 22 August 2014 00:22, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
>
> On 08/22/2014 12:01 AM, Manuel LÃpez-IbÃÃez wrote:
>>
>> On 21 August 2014 23:35, Jason Merrill <jason@redhat.com> wrote:
>>>
>>> On 08/21/2014 04:22 PM, Manuel LÃpez-IbÃÅez wrote:
>>>>
>>>> +                       && TREE_CODE (x) != FUNCTION_DECL
>>>> +                       && !FUNCTION_POINTER_TYPE_P (TREE_TYPE (x))))
>>>
>>>
>>> How about pointer to member function?
>>
>> Maybe like this? BTW, I did not actually want to include the
>> gcc_assert(), it was just a sanity check, thus I deleted it from this
>> patch.
>
> Note by the way, that this patch would introduce the *first* use of
> FUNCTION_POINTER_TYPE_P in the C++ front-end. Are we sure we want to use
> that vs TYPE_PTRFN_P?!? At the moment I'm a bit tired by I seem to remember
> subtleties in this area...

I took all the comments above into consideration and produced this new
version. Since the comments in cp-tree.h did actually confuse me more
than help, I decided to make them more consistent. This could be
committed together, separated or not at all as you wish.

Bootstrapped and regression tested.

gcc/cp/ChangeLog:

2014-08-22  Manuel LÃpez-IbÃÃez  <manu@gcc.gnu.org>

    PR c++/57709
    * name-lookup.c (pushdecl_maybe_friend_1): Do not warn if a
    declaration shadows a function declaration, unless the former
    declares a function, pointer to function or pointer to member
    function, because this is a common and valid case in real-world
    code.
    * cp-tree.h (TYPE_PTRFN_P,TYPE_REFFN_P,TYPE_PTRMEMFUNC_P):
    Improve description.

gcc/testsuite/ChangeLog:

2014-08-22  Manuel LÃpez-IbÃÃez  <manu@gcc.gnu.org>

    PR c++/57709
    * g++.dg/Wshadow.C: New test.

Attachment: pr57709.diff
Description: Text document


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