public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Jonathan Wakely <jwakely@redhat.com>, gcc-patches@gcc.gnu.org
Cc: Marek Polacek <polacek@redhat.com>
Subject: Re: [PATCH] c++: Do not warn about lifetime of std::initializer_list<T>& [PR102482]
Date: Wed, 6 Oct 2021 19:49:59 -0400	[thread overview]
Message-ID: <7cbdd707-43f8-9a8f-79fc-5976144205f1@redhat.com> (raw)
In-Reply-To: <YVd2bMMgZtEVITN1@redhat.com>

On 10/1/21 16:58, Jonathan Wakely wrote:
> An initializer-list constructor taking a non-const lvalue cannot be
> called with a temporary, so the array's lifetime probably doesn't end
> with the full expression. -Winit-list-lifetime should not warn for that
> case.
> 
> 	PR c++/102482
> 
> gcc/cp/ChangeLog:
> 
> 	* init.c (maybe_warn_list_ctor): Do not warn for a reference to
> 	a non-const std::initializer_list.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.dg/warn/Winit-list5.C: New test.
> 
> 
> 
> Tested x86_64-linux. OK for trunk?

OK, thanks.

Jason


      reply	other threads:[~2021-10-06 23:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 20:58 Jonathan Wakely
2021-10-06 23:49 ` Jason Merrill [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7cbdd707-43f8-9a8f-79fc-5976144205f1@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=polacek@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).