This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/58051] [DR1579] No named return value optimization when returned object is implicitly converted
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 26 Jun 2014 10:06:12 +0000
- Subject: [Bug c++/58051] [DR1579] No named return value optimization when returned object is implicitly converted
- Auto-submitted: auto-generated
- References: <bug-58051-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58051
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I wonder if it's this simple:
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -8618,8 +8618,6 @@ check_return_expr (tree retval, bool *no_warning)
|| TREE_CODE (retval) == PARM_DECL)
&& DECL_CONTEXT (retval) == current_function_decl
&& !TREE_STATIC (retval)
- && same_type_p ((TYPE_MAIN_VARIANT (TREE_TYPE (retval))),
- (TYPE_MAIN_VARIANT (functype)))
/* This is only interesting for class type. */
&& CLASS_TYPE_P (functype))
flags = flags | LOOKUP_PREFER_RVALUE;