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.
nathan
--
Nathan Sidwell