@@ -1679,6 +1679,7 @@ build_comparison_op (tree fndecl, bool defining, tsubst_flags_t complain)
if (defining)
{
tree var = create_temporary_var (rettype);
+ DECL_NAME (var) = get_identifier ("retval");
pushdecl (var);
cp_finish_decl (var, comp, false, NULL_TREE, flags);
comp = retval = var;
@@ -11174,6 +11174,7 @@ check_return_expr (tree retval, bool *no_warning)
current_function_return_value = bare_retval;
else if (current_function_return_value
&& VAR_P (current_function_return_value)
+ && DECL_NAME (current_function_return_value)
&& !decl_in_scope_p (current_function_return_value))
{
/* The earlier NRV is out of scope at this point, so it's safe to