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] Add fix-it hint for missing return statement in assignment operators (PR c++/85523)


On Fri, Aug 3, 2018 at 11:41 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> On Tue, 2018-05-01 at 07:18 -0400, Nathan Sidwell wrote:
>> On 04/30/2018 08:29 PM, David Malcolm wrote:
>> > Following on from the thread on the "gcc" list here:
>> >
>> >    https://gcc.gnu.org/ml/gcc/2018-04/msg00172.html
>> >
>> > here's an updated version of Jonathan's patch, which:
>> > +   {
>> > +     tree valtype = TREE_TYPE (DECL_RESULT (fndecl));
>> > +     if (TREE_CODE (valtype) == REFERENCE_TYPE
>> > +         && same_type_ignoring_top_level_qualifiers_p
>> > +             (TREE_TYPE (valtype), TREE_TYPE
>> > (current_class_ref)))
>>
>> While this is probably close enough, you could
>> *) use convert_to_base to include cases where the return type's a
>> base
>> of the current object.
>> *) convert_to_base would also allow dropping the REFERENCE_TYPE
>> check
>> here, so icky code returning by-value could also be caught.
>>
>> Up to you.  But otherwise ok.
>
> Sorry about the belated response; this fell off my radar for some
> reason.
>
> I looked at updating it to support the cases you suggest, but I wasn't
> happy with issuing the fix-it hint for them, so I've gone with the
> patch as-is.
>
> Committed to trunk as r263298 (after rebasing and re-testing)
>

This caused:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86872


-- 
H.J.


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