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]

[4.1 PATCH] Fix note_decl_for_pch (PR c++/28217)


Hi!

This is a P1 that has been fixed on 4.2+.
Bootstrapped/regtested on 4.1 branch {x86_64,ia64,s390,s390x}-linux.
Ok for 4.1 too?  Is the testcase ok for 4.2/trunk (noticed there
has been no testcase committed for this)?

2007-01-03  Jakub Jelinek  <jakub@redhat.com>

	PR c++/28217
	Backported from mainline
	2006-07-12  Jason Merrill  <jason@redhat.com>
	* semantics.c (note_decl_for_pch): Don't premangle templates.

	* g++.dg/pch/template-1.C: New test.
	* g++.dg/pch/template-1.Hs: New file.

--- gcc/cp/semantics.c	(revision 115398)
+++ gcc/cp/semantics.c	(revision 115399)
@@ -2339,8 +2339,9 @@ note_decl_for_pch (tree decl)
 
   /* There's a good chance that we'll have to mangle names at some
      point, even if only for emission in debugging information.  */
-  if (TREE_CODE (decl) == VAR_DECL
-      || TREE_CODE (decl) == FUNCTION_DECL)
+  if ((TREE_CODE (decl) == VAR_DECL
+       || TREE_CODE (decl) == FUNCTION_DECL)
+      && !processing_template_decl)
     mangle_decl (decl);
 }
 
--- gcc/testsuite/g++.dg/pch/template-1.C.jj	2007-01-03 17:49:40.000000000 +0100
+++ gcc/testsuite/g++.dg/pch/template-1.C	2007-01-03 17:51:35.000000000 +0100
@@ -0,0 +1,8 @@
+// PR c++/28217
+
+#include "template-1.H"
+
+int
+main (void)
+{
+}
--- gcc/testsuite/g++.dg/pch/template-1.Hs.jj	2007-01-03 17:49:06.000000000 +0100
+++ gcc/testsuite/g++.dg/pch/template-1.Hs	2007-01-03 17:44:39.000000000 +0100
@@ -0,0 +1,5 @@
+template<int> struct A
+{
+  enum { a, b = a };
+  void foo(A<b>);
+};

	Jakub


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