Commit c1b83cc9 by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

re PR c++/13106 (Wrong warning "no return statement ..." for void template function)

	PR c++/13106
	* decl.c (finish_function): Check if return type is dependent before
	issuing no return statement warning.

	* g++.dg/warn/noreturn-3.C: New test.

From-SVN: r74616
parent d8f95bed
2003-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/13106
* decl.c (finish_function): Check if return type is dependent before
issuing no return statement warning.
2003-12-12 Nathan Sidwell <nathan@codesourcery.com> 2003-12-12 Nathan Sidwell <nathan@codesourcery.com>
PR c++/13118 PR c++/13118
......
...@@ -10819,6 +10819,7 @@ finish_function (int flags) ...@@ -10819,6 +10819,7 @@ finish_function (int flags)
/* Complain if there's just no return statement. */ /* Complain if there's just no return statement. */
if (warn_return_type if (warn_return_type
&& TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE && TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE
&& !dependent_type_p (TREE_TYPE (fntype))
&& !current_function_returns_value && !current_function_returns_null && !current_function_returns_value && !current_function_returns_null
/* Don't complain if we abort or throw. */ /* Don't complain if we abort or throw. */
&& !current_function_returns_abnormally && !current_function_returns_abnormally
......
2003-12-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/13106
* g++.dg/warn/noreturn-3.C: New test.
2003-12-12 Nathan Sidwell <nathan@codesourcery.com> 2003-12-12 Nathan Sidwell <nathan@codesourcery.com>
PR c++/13118 PR c++/13118
......
// { dg-do compile }
// { dg-options "-Wall" }
// Origin: stip@mathematik.uni-ulm.de
// Andrew Pinski <pinskia@gcc.gnu.org>
// PR c++/13106: No return warning when return type is a dependent type.
template <typename T> T dummy() { }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment