C++17 copy elision improvements.
authorJason Merrill <jason@redhat.com>
Thu, 6 Oct 2016 21:24:40 +0000 (17:24 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 6 Oct 2016 21:24:40 +0000 (17:24 -0400)
commitb7558a2c1f87e374c48fa2be8e3ab93e1b3c68b0
treec9167e38db4b5297835f67da69fdb6b691450d9f
parent937ec71aba5b3c633bd5979d6346254e83f46d1c
C++17 copy elision improvements.

* call.c (build_temp, convert_like_real): Don't re-copy
TARGET_EXPR.  Handle packed fields.
(build_x_va_arg): Wrap it in a TARGET_EXPR.
(build_over_call): Add sanity check.
* cvt.c (early_elide_copy): New.
(ocp_convert): Use it.
* except.c (build_throw): Use it.
* init.c (get_nsdmi): Put back the TARGET_EXPR.
(expand_default_init): Call early_elide_copy.
* typeck.c (cp_build_modify_expr): Call early_elide_copy.

From-SVN: r240845
20 files changed:
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/cp/cvt.c
gcc/cp/except.c
gcc/cp/init.c
gcc/cp/typeck.c
gcc/doc/invoke.texi
gcc/testsuite/g++.dg/cpp0x/constexpr-ctor14a.C
gcc/testsuite/g++.dg/cpp0x/initlist9.C
gcc/testsuite/g++.dg/cpp0x/noexcept23.C
gcc/testsuite/g++.dg/cpp0x/noexcept24.C
gcc/testsuite/g++.dg/cpp1z/elide1.C
gcc/testsuite/g++.dg/init/copy3.C
gcc/testsuite/g++.dg/overload/arg3.C
gcc/testsuite/g++.dg/template/copy1.C
gcc/testsuite/g++.old-deja/g++.eh/ctor1.C
gcc/testsuite/g++.old-deja/g++.jason/temporary2.C
gcc/testsuite/g++.old-deja/g++.mike/p2431.C
gcc/testsuite/g++.old-deja/g++.pt/auto_ptr.C