------- Comment #4 from gdr at integrable-solutions dot net 2005-11-29 18:02
-------
Subject: Re: [3.4/4.0/4.1 Regression] wrong error message (int instead of
bool)
"pinskia at gcc dot gnu dot org" <[EMAIL PROTECTED]> writes:
| Hmm, it is looking at the wrong type, it is looking at the RESULT_DECL's type
| instead of the FUNCTION_TYPE's type which has the correct type, I might fix
| this later tonight.
Try this
*** ChangeLog (revision 107674)
--- ChangeLog (local)
***************
*** 1,3 ****
--- 1,10 ----
+ 2005-11-29 Gabriel Dos Reis <[EMAIL PROTECTED]>
+
+ PR c++/25156
+ * typeck.c (check_return_expr): Get the return-type from the
+ function declaration, now that the named-return value extension is
+ no longer existent.
+
2005-11-30 Ben Elliston <[EMAIL PROTECTED]>
* typeck.c (build_x_unary_op): Correct spelling in error message.
*** typeck.c (revision 107674)
--- typeck.c (local)
*************** check_return_expr (tree retval, bool *no
*** 6257,6270 ****
return retval;
}
! /* When no explicit return-value is given in a function with a named
! return value, the named return value is used. */
! result = DECL_RESULT (current_function_decl);
! valtype = TREE_TYPE (result);
gcc_assert (valtype != NULL_TREE);
fn_returns_value_p = !VOID_TYPE_P (valtype);
- if (!retval && DECL_NAME (result) && fn_returns_value_p)
- retval = result;
/* Check for a return statement with no return value in a function
that's supposed to return a value. */
--- 6257,6269 ----
return retval;
}
! /* We no longer support the old "named-return value" extension, so get
! the return-type from the function declaration. */
! valtype = TREE_TYPE (TREE_TYPE (current_function_decl));
gcc_assert (valtype != NULL_TREE);
+ result = DECL_RESULT (current_function_decl);
+ gcc_assert (TREE_TYPE (result) != 0);
fn_returns_value_p = !VOID_TYPE_P (valtype);
/* Check for a return statement with no return value in a function
that's supposed to return a value. */
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25156