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]

[patch] Testcase for PR 12370


The first patch provides a testcase for PR 12316 which was fixed
by Richard. The second patch adds the PR number to the ChangeLog
entry for the fix.

Ok to commit to mainline?

Regards,
Volker


2003-10-13  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	PR c++/12370
	* g++.dg/other/friend2.C: New test.

Index: g++.dg/other/friend2.C
===================================================================
RCS file: g++.dg/other/friend2.C
diff -N g++.dg/other/friend2.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ g++.dg/other/friend2.C	11 Oct 2003 01:15:48 -0000
@@ -0,0 +1,23 @@
+// { dg-do run }
+// Origin: Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+// PR c++/12370
+// Wrong code because of the friend declaration
+
+template <typename T> struct A
+{
+    T x;
+    A(T t) : x(t) {}
+    friend A<int> foo (const A<unsigned>&);
+};
+
+A<int> foo (const A<unsigned>& a)
+{
+    A<int> res(a.x);
+    return res;
+}
+
+int main()
+{
+    return foo(A<unsigned>(0)).x;
+}
===================================================================


2003-10-13  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>

	* ChangeLog: Add PR number to patch for PR c++/12370.

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.3723
diff -u -p -r1.3723 ChangeLog
--- ChangeLog	12 Oct 2003 22:09:27 -0000	1.3723
+++ ChangeLog	13 Oct 2003 22:39:59 -0000
@@ -73,6 +73,7 @@
 
 2003-09-30  Richard Henderson  <rth@redhat.com>
 
+	PR c++/12370
 	* decl.c (duplicate_decls): Copy DECL_SAVED_INSNS too.
 
 2003-09-30  Kelley Cook  <kelleycoook@wideopenwest.com>
===================================================================



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