On 02/23/2018 07:32 PM, Jason Merrill wrote:
On Sun, Feb 18, 2018 at 11:39 PM, Jason Merrill <ja...@redhat.com> wrote:
On Fri, Feb 16, 2018 at 4:33 PM, Martin Sebor <mse...@gmail.com> wrote:
On 02/16/2018 07:04 AM, Jason Merrill wrote:
On Thu, Feb 15, 2018 at 6:36 PM, Martin Sebor <mse...@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