PR c++/67445 - returning temporary initializer_list.
authorJason Merrill <jason@redhat.com>
Tue, 29 May 2018 20:04:52 +0000 (16:04 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 29 May 2018 20:04:52 +0000 (16:04 -0400)
commit04eb9c55747cc28466875e891ac22acb3ea67644
treeae59c85ca4dce30aa95d2fe4a1f09b0dd582049e
parent5d2e68ea0afc4dbb3fda7679c19749a0a5dd6def
PR c++/67445 - returning temporary initializer_list.

PR c++/67711 - assigning from temporary initializer_list.
PR c++/48562 - new initializer_list.
* typeck.c (maybe_warn_about_returning_address_of_local): Also warn
about returning local initializer_list.
* cp-tree.h (AUTO_TEMP_NAME, TEMP_NAME_P): Remove.
* call.c (build_over_call): Warn about assignment from temporary
init_list.
* init.c (build_new_1): Warn about 'new std::initializer_list'.
(find_list_begin, maybe_warn_list_ctor): New.
(perform_member_init): Use maybe_warn_list_ctor.

From-SVN: r260905
18 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/cp/init.c
gcc/cp/typeck.c
gcc/doc/invoke.texi
gcc/testsuite/c-c++-common/pr43395.c
gcc/testsuite/g++.dg/cpp1y/pr77591.C
gcc/testsuite/g++.dg/warn/Winit-list1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Winit-list2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Winit-list3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wreturn-local-addr.C
gcc/testsuite/g++.dg/warn/return-reference2.C
gcc/testsuite/g++.old-deja/g++.bob/array1.C
gcc/testsuite/g++.old-deja/g++.brendan/crash55.C
libstdc++-v3/testsuite/util/testsuite_random.h