From: Marek Polacek <polacek@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: C++ PATCH for c++/78244 - narrowing conversion in template not detected, part 2
Date: Wed, 23 Jan 2019 18:29:00 -0000 [thread overview]
Message-ID: <20190123175735.GF26714@redhat.com> (raw)
In-Reply-To: <33c9ff91-1aff-d328-7349-767b196eaecf@redhat.com>
On Wed, Jan 23, 2019 at 09:00:36AM -0500, Jason Merrill wrote:
> I was talking about digest_init, not reshape_init. digest_init calls
> convert_for_initialization.
/facepalm
So yes, digest_init calls convert_for_initialization which will end up
calling perform_implicit_conversion_flags which could call convert_like_real
where the narrowing warnings are given, but it doesn't, we go to this case:
else if (processing_template_decl && conv->kind != ck_identity)
{
/* In a template, we are only concerned about determining the
type of non-dependent expressions, so we do not have to
perform the actual conversion. But for initializers, we
need to be able to perform it at instantiation
(or instantiate_non_dependent_expr) time. */
expr = build1 (IMPLICIT_CONV_EXPR, type, expr);
finish_decltype_type throws away the expression because it's not dependent, and
only uses its type. So narrowing remains undetected. Not sure if I should mess
with perform_implicit_conversion_flags.
next prev parent reply other threads:[~2019-01-23 17:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-17 19:09 Marek Polacek
2019-01-17 21:17 ` Jason Merrill
2019-01-18 14:12 ` Marek Polacek
2019-01-21 20:15 ` Jason Merrill
2019-01-22 21:12 ` Marek Polacek
2019-01-23 14:01 ` Jason Merrill
2019-01-23 18:29 ` Marek Polacek [this message]
2019-01-23 20:51 ` Jason Merrill
2019-01-25 0:51 ` Marek Polacek
2019-01-25 15:06 ` Jason Merrill
2019-01-25 21:55 ` Marek Polacek
2019-01-27 0:25 ` Jason Merrill
2019-01-27 20:18 ` Marek Polacek
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=20190123175735.GF26714@redhat.com \
--to=polacek@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@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).