Blame SOURCES/gcc32-pr13106.patch

4ac4fd
2005-09-23  Alexandre Oliva  <aoliva@redhat.com>
4ac4fd
4ac4fd
	* decl.c (finish_function): Skip no-return-statment warning if
4ac4fd
	the return type uses template parms.
4ac4fd
4ac4fd
	* g++.dg/warn/return-void-1.C: New test.
4ac4fd
4ac4fd
--- gcc/cp/decl.c.orig
4ac4fd
+++ gcc/cp/decl.c
4ac4fd
@@ -14475,7 +14475,8 @@ finish_function (flags)
4ac4fd
       && !DECL_NAME (DECL_RESULT (fndecl))
4ac4fd
       /* Normally, with -Wreturn-type, flow will complain.  Unless we're an
4ac4fd
 	 inline function, as we might never be compiled separately.  */
4ac4fd
-      && (DECL_INLINE (fndecl) || processing_template_decl))
4ac4fd
+      && (DECL_INLINE (fndecl) || processing_template_decl)
4ac4fd
+      && !uses_template_parms (TREE_TYPE (fntype)))
4ac4fd
     warning ("no return statement in function returning non-void");
4ac4fd
     
4ac4fd
   /* Clear out memory we no longer need.  */
4ac4fd
--- gcc/testsuite/g++.dg/warn/return-void-1.C
4ac4fd
+++ gcc/testsuite/g++.dg/warn/return-void-1.C
4ac4fd
@@ -0,0 +1,15 @@
4ac4fd
+// { dg-do compile }
4ac4fd
+// { dg-options "-Wall" }
4ac4fd
+
4ac4fd
+template <typename T> T dummy1() {}
4ac4fd
+template <typename T> T dummy2() {} // { dg-warning "end of non-void" }
4ac4fd
+template <typename T> inline T dummy3() {}
4ac4fd
+template <typename T> inline T dummy4() {} // { dg-warning "end of non-void|no return statement" }
4ac4fd
+
4ac4fd
+int main()
4ac4fd
+{
4ac4fd
+  dummy1<void>();
4ac4fd
+  dummy2<int>(); // { dg-warning "instantiated from here" }
4ac4fd
+  dummy3<void>();
4ac4fd
+  dummy4<int>(); // { dg-warning "instantiated from here" }
4ac4fd
+}