aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-05-08 15:08:07 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-05-08 15:08:07 -0400
commitf3ec182d6ca9829004b3b78fca373b8659bf7c01 (patch)
treed0f58768cb3ec5c1371ac6b542dc445f97d43863 /gcc/testsuite
parent49f0c04c37b2f73dd88ccf5d8fc93c1dcb6ef2c2 (diff)
downloadgcc-f3ec182d6ca9829004b3b78fca373b8659bf7c01.zip
gcc-f3ec182d6ca9829004b3b78fca373b8659bf7c01.tar.gz
gcc-f3ec182d6ca9829004b3b78fca373b8659bf7c01.tar.bz2
PR c++/80178 - parameter passing for uncopyable classes
* tree.c (type_has_nontrivial_copy_init): True for classes with only deleted copy/move ctors. (remember_deleted_copy, maybe_warn_parm_abi): New. * decl.c (require_complete_types_for_parms, check_function_type): Call maybe_warn_parm_abi. * call.c (convert_for_arg_passing, build_cxx_call): Likewise. From-SVN: r247757
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/g++.dg/abi/invisiref1.C24
-rw-r--r--gcc/testsuite/g++.dg/abi/invisiref1a.C24
2 files changed, 48 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/abi/invisiref1.C b/gcc/testsuite/g++.dg/abi/invisiref1.C
new file mode 100644
index 0000000..5534b89
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/invisiref1.C
@@ -0,0 +1,24 @@
+// PR c++/80178
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wabi=10 -fdump-tree-gimple" }
+// { dg-final { scan-tree-dump "foo .&D" "gimple" } }
+
+struct A {
+ A();
+ A &operator=(A &&o);
+ void *p;
+};
+void notdefined(A);
+
+void foo(A) { } // { dg-warning "calling convention" }
+
+A baz() // { dg-warning "calling convention" }
+{
+ return {};
+}
+
+void bar() {
+ foo({}); // { dg-warning "calling convention" }
+ notdefined({}); // { dg-warning "calling convention" }
+ baz(); // { dg-warning "calling convention" }
+}
diff --git a/gcc/testsuite/g++.dg/abi/invisiref1a.C b/gcc/testsuite/g++.dg/abi/invisiref1a.C
new file mode 100644
index 0000000..aff7b1a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/invisiref1a.C
@@ -0,0 +1,24 @@
+// PR c++/80178
+// { dg-do compile { target c++11 } }
+// { dg-options "-fabi-version=11 -Wabi -fdump-tree-gimple" }
+// { dg-final { scan-tree-dump "foo .D" "gimple" } }
+
+struct A {
+ A();
+ A &operator=(A &&o);
+ void *p;
+};
+void notdefined(A);
+
+void foo(A) { } // { dg-warning "calling convention" }
+
+A baz() // { dg-warning "calling convention" }
+{
+ return {};
+}
+
+void bar() {
+ foo({}); // { dg-warning "calling convention" }
+ notdefined({}); // { dg-warning "calling convention" }
+ baz(); // { dg-warning "calling convention" }
+}