summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-09 16:33:44 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-09 16:33:44 +0000
commit01779b5f326eeebf30b0fe4f798c785eede91c0f (patch)
tree47497fa5c9fd195f980d2e24398c007ac46ceca9 /gcc/testsuite
parent917938feecdaa037a6e258e511bdb1a17aa8a130 (diff)
downloadgcc-01779b5f326eeebf30b0fe4f798c785eede91c0f.tar.gz
cp:
PR g++/87 * cp-tree.h (DECL_COPY_CONSTRUCTOR_P): Use copy_fn_p. (copy_args_p): Rename to ... (copy_fn_p): ... here. (grok_special_member_properties): New function. (grok_op_properties): Lose VIRTUALP parameter. (copy_assignment_arg_p): Remove. * call.c (build_over_call): Use copy_fn_p. * decl.c (grokfndecl): Reformat. Adjust call to grok_op_properties. (copy_args_p): Rename to ... (copy_fn_p): ... here. Reject template functions. Check for pass by value. (grok_special_member_properties): Remember special functions. (grok_ctor_properties): Don't remember them here, just check. (grok_op_properties): Likewise. (start_method): Call grok_special_member_properties. * decl2.c (grokfield): Likewise. (copy_assignment_arg_p): Remove. (grok_function_init): Don't remember abstract assignment here. * pt.c (instantiate_class_template): Call grok_special_member_properties. (tsubst_decl): Adjust grok_op_properties call. testsuite: * g++.dg/other/copy1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47813 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/other/copy1.C83
2 files changed, 87 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1320d3cedc9..9c774301cb9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2001-12-09 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.dg/other/copy1.C: New test.
+
2001-10-08 Aldy Hernandez <aldyh@redhat.com>
* gcc.c-torture/execute/builtin-types-compatible-p.c: New.
diff --git a/gcc/testsuite/g++.dg/other/copy1.C b/gcc/testsuite/g++.dg/other/copy1.C
new file mode 100644
index 00000000000..d02b08fce09
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/copy1.C
@@ -0,0 +1,83 @@
+// { dg-do run }
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 30 Nov 2001 <nathan@nathan@codesourcery.com>
+
+// PR 87
+
+int assign = 0;
+int ctor = 0;
+int assignC = 0;
+
+struct A {
+ int i;
+
+ template<class T>
+ void operator=(const T&) const
+ {
+ assign = 1;
+ }
+
+ A () : i (0) {}
+
+ template <typename T> A (const T &)
+ {
+ ctor = 1;
+ }
+};
+
+struct B : A
+{
+};
+
+struct C
+{
+ int i;
+
+ C (int i_) :i (i_) {}
+
+ template <int I>
+ void operator= (const C &)
+ {
+ assignC = 1;
+ }
+};
+
+
+int main()
+{
+ const A a;
+ A b;
+ B c;
+
+ b = a;
+ if (assign)
+ return 5;
+
+ b.i = 100;
+ c.i = 200;
+
+ a = b;
+
+ if (!assign)
+ return 1;
+ if (a.i)
+ return 2;
+
+ A e (b);
+ if (ctor)
+ return 3;
+
+ A d (c);
+ if (!ctor)
+ return 4;
+
+ C c0 (0);
+ C c1 (1);
+
+ c0 = c1;
+ if (assignC)
+ return 5;
+
+ return 0;
+}