diff options
author | Marek Polacek <polacek@redhat.com> | 2020-10-29 15:08:31 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2020-11-03 10:09:00 -0500 |
commit | f620e64a6f13371b95be5b17abba0acf15bf7cae (patch) | |
tree | a0d2b08c0195e9b82eb50a635fd6efe333c39144 /gcc/cp/init.c | |
parent | 6ff95a6eefbe02288fbc9f3de456e5e820d2bd80 (diff) | |
download | gcc-f620e64a6f13371b95be5b17abba0acf15bf7cae.zip gcc-f620e64a6f13371b95be5b17abba0acf15bf7cae.tar.gz gcc-f620e64a6f13371b95be5b17abba0acf15bf7cae.tar.bz2 |
c++: Disable -Winit-list-lifetime in unevaluated operand [PR97632]
Jon suggested turning this warning off when we're not actually
evaluating the operand. This patch does that.
gcc/cp/ChangeLog:
PR c++/97632
* init.c (build_new_1): Disable -Winit-list-lifetime for an unevaluated
operand.
gcc/testsuite/ChangeLog:
PR c++/97632
* g++.dg/warn/Winit-list4.C: New test.
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 1bddb655..ffb84ea 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2957,7 +2957,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts, return error_mark_node; } - if (is_std_init_list (elt_type)) + if (is_std_init_list (elt_type) && !cp_unevaluated_operand) warning (OPT_Winit_list_lifetime, "%<new%> of %<initializer_list%> does not " "extend the lifetime of the underlying array"); |