]> gcc.gnu.org Git - gcc.git/commitdiff
PR c++/86094 - wrong code with defaulted move ctor.
authorJason Merrill <jason@redhat.com>
Mon, 11 Jun 2018 18:38:52 +0000 (14:38 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 11 Jun 2018 18:38:52 +0000 (14:38 -0400)
* tree.c (type_has_nontrivial_copy_init): Fix move ctor handling.

From-SVN: r261444

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/g++.dg/abi/invisiref2.C [new file with mode: 0644]

index bdf717f82fb0ec57bb957a30c578cbc7a4e8c031..595a08f3d448132b7fc91b2d5ad8f575b3fdb5e5 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/86094 - wrong code with defaulted move ctor.
+       * tree.c (type_has_nontrivial_copy_init): Fix move ctor handling.
+
 2018-06-10  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * decl.c (grokfndecl): Use the location_t argument in two more places.
index bbbda7e98b60d850f66f1037ba1d8c84897ad281..156d1e469c605f441f5081f2a83433f8c7344203 100644 (file)
@@ -4135,7 +4135,7 @@ type_has_nontrivial_copy_init (const_tree type)
        for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
          {
            tree fn = *iter;
-           if (copy_fn_p (fn))
+           if (copy_fn_p (fn) || move_fn_p (fn))
              {
                saw_copy = true;
                if (!DECL_DELETED_FN (fn))
diff --git a/gcc/testsuite/g++.dg/abi/invisiref2.C b/gcc/testsuite/g++.dg/abi/invisiref2.C
new file mode 100644 (file)
index 0000000..592d212
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/86094
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wabi=11 -fdump-tree-gimple" }
+// { dg-final { scan-tree-dump-not "struct S &" "gimple" } }
+
+struct S {
+  S(S&&) = default;
+  int i;
+};
+
+S foo(S s)
+{
+  return s;
+}
This page took 0.080164 seconds and 5 git commands to generate.