OSDN Git Service

PR c++/12370
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 13 Oct 2003 23:06:37 +0000 (23:06 +0000)
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 13 Oct 2003 23:06:37 +0000 (23:06 +0000)
* g++.dg/other/friend2.C: New test.
* ChangeLog: Add PR number to patch for PR c++/12370.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72446 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/friend2.C [new file with mode: 0644]

index 9611f33..240f451 100644 (file)
@@ -1,3 +1,7 @@
+2003-10-13  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       * ChangeLog: Add PR number to patch for PR c++/12370.
+
 2003-10-13  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        Break out decl.c (2/n) 
 
 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 96d41b6..77e51a5 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-13  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/12370
+       * g++.dg/other/friend2.C: New test.
+
 2003-10-12  Steven Bosscher  <steven@gcc.gnu.org>
 
        * gcc.dg/20031012-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/other/friend2.C b/gcc/testsuite/g++.dg/other/friend2.C
new file mode 100644 (file)
index 0000000..ce5d2b7
--- /dev/null
@@ -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;
+}