From: Martin Sebor <msebor@gmail.com>
To: Jason Merrill <jason@redhat.com>
Cc: Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] replace ICE with error for failed template deduction (PR 84355)
Date: Tue, 06 Mar 2018 00:05:00 -0000 [thread overview]
Message-ID: <8250dd22-1748-da7e-ad25-38ca1416821a@gmail.com> (raw)
In-Reply-To: <CADzB+2=dkyN1kmKKP9-QvF=BbZvGrX2p6mABa0aZaCOouq--Xg@mail.gmail.com>
On 02/23/2018 07:32 PM, Jason Merrill wrote:
> On Sun, Feb 18, 2018 at 11:39 PM, Jason Merrill <jason@redhat.com> wrote:
>> On Fri, Feb 16, 2018 at 4:33 PM, Martin Sebor <msebor@gmail.com> wrote:
>>> On 02/16/2018 07:04 AM, Jason Merrill wrote:
>>>>
>>>> On Thu, Feb 15, 2018 at 6:36 PM, Martin Sebor <msebor@gmail.com> wrote:
>>>>>
>>>>> A failed template deduction in template member of a template
>>>>> triggers an ICE with -std=c++17 due to what seems like
>>>>> a missing handling of invalid input. Replacing
>>>>> the gcc_unreachable() call that causes the ICE with a return
>>>>> statement indicating the deduction failure eliminates the ICE
>>>>> and restores sane diagnostics.
>>>>
>>>>
>>>> Hmm, we really shouldn't have gotten there; that assert is checking
>>>> that when we see a TEMPLATE_*_PARM node in the template signature, it
>>>> corresponds to one of the actual parms of the template. Sounds like
>>>> something is going wrong in build_deduction_guide.
>>>
>>>
>>> Are you suggesting that build_deduction_guide should fail somehow
>>> (it's not expected to fail right now) or that the guide it creates
>>> is wrong?
>>
>> The latter. Maybe we're handling T wrong somehow? We shouldn't be
>> trying to deduce it. In fact, we probably shouldn't be trying to
>> deduce arguments for 'b' until we instantiate A.
>
> Looks like the problem is that when we substitute into the
> TEMPLATE_TYPE_PARM representing 'B' in the function, we don't touch
> CLASS_PLACEHOLDER_TEMPLATE:
>
> else if (tree pl = CLASS_PLACEHOLDER_TEMPLATE (t))
> {
> if (DECL_TEMPLATE_TEMPLATE_PARM_P (pl))
> pl = tsubst (pl, args, complain, in_decl);
> CLASS_PLACEHOLDER_TEMPLATE (r) = pl;
> }
>
> This code is failing to replace A<T>::B with A<int>::B.
I don't know what to do here/what you're suggesting. Before
the call to tsubst() pl is a TEMPLATE_DECL of struct A<T>::B.
Calling tsubst() works and replaces the ICE with a reasonable
error but then causes an ICE in cpp1z/class-deduction19.C.
There, pl is also TEMPLATE_DECL, and I'm not sure how to
differentiate between the two at this level.
I was hoping I could fix this ICE quickly but I've spent too
much time on it with no progress so unless I'm just being
dense by missing your hint I think I'm going to have to give
up on this bug.
Martin
next prev parent reply other threads:[~2018-03-06 0:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 23:36 Martin Sebor
2018-02-16 14:04 ` Jason Merrill
2018-02-16 19:31 ` Jason Merrill
2018-02-16 21:33 ` Martin Sebor
2018-02-19 4:39 ` Jason Merrill
2018-02-24 2:33 ` Jason Merrill
2018-03-06 0:05 ` Martin Sebor [this message]
2018-03-12 14:40 ` Jason Merrill
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=8250dd22-1748-da7e-ad25-38ca1416821a@gmail.com \
--to=msebor@gmail.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).