From: Jason Merrill <jason@redhat.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Soul Studios <matt@soulstudios.co.nz>,
"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Apparent deeply-nested missing error bug with gcc 7.3
Date: Tue, 19 Jun 2018 18:30:00 -0000 [thread overview]
Message-ID: <CADzB+2mB8oonvefdk-R0Cad9GCTerS9gyRPK2Efvus+b_XA6wA@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdQQvcsKz+MCjbcBTM73LN+UA2oRvmONekG7PxzjRqhNZQ@mail.gmail.com>
On Tue, Jun 19, 2018 at 6:04 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On Tue, 19 Jun 2018 at 01:30, Soul Studios wrote:
>>
>> >
>> > It's never called.
>> >
>> > I added a call to abort() to that function, and the tests all pass. So
>> > the function is never used, so GCC never compiles it and doesn't
>> > notice that the return type is invalid. That's allowed by the
>> > standard. The compiler is not required to diagnose ill-formed code in
>> > uninstantiated templates.
>> >
>>
>>
>> UPDATE: My bad.
>> The original compiler feature detection on the test suite was broken/not
>> matching the correct libstdc++ versions.
>> Hence the emplace_back/emplace_front tests were not running.
>
> Told you so :-P
>
>
>> However, it does surprise me that GCC doesn't check this code.
>
> It's a dependent expression so can't be fully checked until
> instantiated -- and as you've discovered, it wasn't being
> instantiated. There's a trade-off between compilation speed and doing
> additional work to check uninstantiated templates with arbitrarily
> complex expressions in them.
And specifically, &<type-dependent expression> might use an overloaded
operator& that returns a reference, so it might be possible to have a
valid instantiation, so the compiler must not reject the template.
Jason
next prev parent reply other threads:[~2018-06-19 17:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 8:46 Soul Studios
2018-06-18 11:21 ` Jonathan Wakely
2018-06-18 12:35 ` Jonathan Wakely
2018-06-19 0:31 ` Soul Studios
2018-06-19 10:04 ` Soul Studios
2018-06-19 10:37 ` Jonathan Wakely
2018-06-19 18:30 ` Jason Merrill [this message]
2018-06-21 8:21 ` Soul Studios
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=CADzB+2mB8oonvefdk-R0Cad9GCTerS9gyRPK2Efvus+b_XA6wA@mail.gmail.com \
--to=jason@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=jwakely.gcc@gmail.com \
--cc=matt@soulstudios.co.nz \
/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).