From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77232 invoked by alias); 24 Feb 2018 02:33:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 77223 invoked by uid 89); 24 Feb 2018 02:33:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mail-it0-f44.google.com Received: from mail-it0-f44.google.com (HELO mail-it0-f44.google.com) (209.85.214.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 24 Feb 2018 02:33:19 +0000 Received: by mail-it0-f44.google.com with SMTP id j7so3978021ita.3 for ; Fri, 23 Feb 2018 18:33:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xyeJPP6y/M3QvYTEKQeuZU7ik+oV3aeT041ZvZ2Zshk=; b=gC3/Tcvo4RNahZbaZWU+gEkFdwdtnEft0CgZYujrTAGPajXQ+2y6eOPfWHTLgvOZHn 7h6DLR/ojwpSPCekz+hb1V6tWBFueEnnmhbqtIWLa5AdjcuspWysEcIgwe0rK7PSpufr KyuSiLwUW4jePVedUai7oojMU2OzxYKRSWvV4xdV4h0/sI7/bJiYQjOKcAWNprUWWsDn cCHmJnJeQXFNTMzL1HqOZ2Rjf7PaEP3rtiC3VhBBtuPKJq+z6c9cVBJJm1sNJGDq4ONv 0fIe/86SgaKTrUPvGpzWR0VjRzcgOID0ubp5uVRqAthAa4cly/A+B2QbFeI5xER+nlst UNMg== X-Gm-Message-State: APf1xPB4FmvkLK9OA7wkA8q/dWTur1O2TWN42gFTi4Ty4xsvfw1rS7vN Pl4NeAJte0fftVIYjoJgcxQZL0vDgnqzIGtO5tKu0w== X-Google-Smtp-Source: AH8x227CWyD/2240Kq1ba3lPp7Gh4qgXoG32JZIvuUWoKJP4taj4ymiaoznwzmddxBszBnHJMY+288g/FprIkkmphQI= X-Received: by 10.36.185.24 with SMTP id w24mr4642826ite.127.1519439597390; Fri, 23 Feb 2018 18:33:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.17.200 with HTTP; Fri, 23 Feb 2018 18:32:56 -0800 (PST) In-Reply-To: References: <786533c4-2017-86c0-8813-0bea046fc7d0@gmail.com> <2a7a4f0c-052e-783a-a51c-8efa77839e8d@gmail.com> From: Jason Merrill Date: Sat, 24 Feb 2018 02:33:00 -0000 Message-ID: Subject: Re: [PATCH] replace ICE with error for failed template deduction (PR 84355) To: Martin Sebor Cc: Gcc Patch List Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg01364.txt.bz2 On Sun, Feb 18, 2018 at 11:39 PM, Jason Merrill wrote: > On Fri, Feb 16, 2018 at 4:33 PM, Martin Sebor wrote: >> On 02/16/2018 07:04 AM, Jason Merrill wrote: >>> >>> On Thu, Feb 15, 2018 at 6:36 PM, Martin Sebor 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::B with A::B. Jason