This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: [Bug c++/13081] [3.3 regression] forward template declarations in <complex> let inlining fail


Forwarding from gcc-bugs.

Thanks,
Andrew Pinski

Begin forwarded message:

From: "doko at cs dot tu-berlin dot de" <gcc-bugzilla@gcc.gnu.org>
Date: December 29, 2003 12:00:23 EST
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/13081] [3.3 regression] forward template declarations in <complex> let inlining fail
Reply-To: gcc-bugzilla@gcc.gnu.org



backported to the gcc-3_3-branch, no regressions on an i486-linux bootstrap. Ok for the branch?

2003-12-28 Mark Mitchell <mark@codesourcery.com>

	PR c++/13081
 	* decl.c (duplicate_decls): Preserve inline-ness when redeclaring
 	a function template.

 	PR c++/13081
 	* g++.dg/opt/inline6.C: New test.

--- gcc/testsuite/g++.dg/opt/inline6.C
+++ gcc/testsuite/g++.dg/opt/inline6.C 2003-12-29 09:12:36.000000000 +0000
@@ -0,0 +1,14 @@
+// PR c++/13081
+// { dg-options "-O2" }
+// { dg-final { scan-assembler-not "foo" } }
+
+template<typename T> T foo(T);
+
+template<typename T> inline T foo(T t)
+{
+ return t;
+}
+
+void bar (long& l) {
+ l = foo(l);
+}


--- gcc/cp/decl.c~	2003-12-29 10:18:13.000000000 +0100
+++ gcc/cp/decl.c	2003-12-29 10:25:57.000000000 +0100
@@ -3737,6 +3737,14 @@
 	    = DECL_SOURCE_LOCATION (newdecl);
 	}

+      if (DECL_FUNCTION_TEMPLATE_P (newdecl))
+	{
+	  DECL_INLINE (DECL_TEMPLATE_RESULT (olddecl))
+	    |= DECL_INLINE (DECL_TEMPLATE_RESULT (newdecl));
+	  DECL_DECLARED_INLINE_P (DECL_TEMPLATE_RESULT (olddecl))
+	    |= DECL_DECLARED_INLINE_P (DECL_TEMPLATE_RESULT (newdecl));
+	}
+
       return 1;
     }



--


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13081





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]