re PR c++/13106 (Wrong warning "no return statement ..." for void template function)
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Sun, 14 Dec 2003 11:06:35 +0000 (11:06 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Sun, 14 Dec 2003 11:06:35 +0000 (11:06 +0000)
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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/noreturn-3.C [new file with mode: 0644]

index 4b9f5cb..31d16d2 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        PR c++/13118
index f205f74..539bf19 100644 (file)
@@ -10819,6 +10819,7 @@ finish_function (int flags)
   /* Complain if there's just no return statement.  */
   if (warn_return_type
       && TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE
+      && !dependent_type_p (TREE_TYPE (fntype))
       && !current_function_returns_value && !current_function_returns_null
       /* Don't complain if we abort or throw.  */
       && !current_function_returns_abnormally
index cabc671..cb89b4f 100644 (file)
@@ -1,3 +1,8 @@
+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>
 
        PR c++/13118
diff --git a/gcc/testsuite/g++.dg/warn/noreturn-3.C b/gcc/testsuite/g++.dg/warn/noreturn-3.C
new file mode 100644 (file)
index 0000000..6680145
--- /dev/null
@@ -0,0 +1,9 @@
+// { 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() { }