From patchwork Tue Feb 13 15:56:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 872945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-473171-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="y55fhUp4"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zgnGc10JBz9s4q for ; Wed, 14 Feb 2018 02:56:55 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=yFHpSTbA5qYB4JQXNp8R9R/KJQzeSXhhumFocyRSFDmkSu eE536cEb5SlviidrrbjdpObw/QpquGS0Q+BJG4frXcu/cJ5+ikDlkYVPGGl15+Uo KCCiiU8RFRP/YZmCw/L68xku1z1P0zpVIOIRC6NTsQUopjXqDkZJzeMGqjo2E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=1dnKGfFYT6eijuUL3VDtGIgFwj8=; b=y55fhUp4gU5hxiZmuqIm qrnddB5AAEGvLl91syCagaEpjiFkYNQzGHgg/DcGTZiZuC+g9d/hOqwadlQ+18Oq 1gjYxv7Svb2aPdQGpS0LTXcUq8mgiRGsTRNENRDSr1oEO5ofyisjHh6ciSy54FlO sn9RL9H7ANmvFLAFea2UdGI= Received: (qmail 61216 invoked by alias); 13 Feb 2018 15:56:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 61207 invoked by uid 89); 13 Feb 2018 15:56:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mail-it0-f51.google.com Received: from mail-it0-f51.google.com (HELO mail-it0-f51.google.com) (209.85.214.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 13 Feb 2018 15:56:47 +0000 Received: by mail-it0-f51.google.com with SMTP id l187so1686797ith.4 for ; Tue, 13 Feb 2018 07:56:46 -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:from:date:message-id:subject:to; bh=REHutmfrw4g1o49aKCYEY8inAxfGVr3xxkahk+wQCts=; b=tkyt8+mZyM4i8vwFW97VTPVTRV1V12Sw0EUxK2IcHF/yjlipSb4caUJaWwZukofY6z lKVUOdQIY9ESgLdXLVPWSfcqrcKQpvykMxD+/32hIgykYztZ+6nxPfK+qnb9bZ8+zsLy sThR62kicTCGQgqvdasUwmh91T4sV2PG3p428oFPeWssuqvuWaEyQZsI/ajU/DwNPdsC jd4y+oSKIcb5JVk1D3SOY6s51V/eB5gTLYZxOjnG8D1TgQFGqvEUmzAkdr+NPthrOIbB +Q46Vkf+xK4ImK1e55is+t5g5l1oYiBogdGnVqLVZYWkzglDAz8oBZ5SBQhM3T41ku3S Pkbw== X-Gm-Message-State: APf1xPAsWWrx7SmGbpBKfShnVEaHaJZUgkqA8KZT6JXPhpI4XCckkPFD luSU9rNES/0FeCu6VrogXAJygW4tfb/NJOm6vEjdRFf7 X-Google-Smtp-Source: AH8x2256n1HG7Z+PwJ+ghHZVLi16hIsfPFX1okRS5fPZ3JSGEwcD/4+lHLAXrCV/xhr1HzigppUS5Hmy9wMt68+CwRA= X-Received: by 10.36.83.148 with SMTP id n142mr2119689itb.10.1518537405114; Tue, 13 Feb 2018 07:56:45 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.17.200 with HTTP; Tue, 13 Feb 2018 07:56:24 -0800 (PST) From: Jason Merrill Date: Tue, 13 Feb 2018 10:56:24 -0500 Message-ID: Subject: C++ PATCH for c++/84080, ICE with return type deduction and specialization To: gcc-patches List X-IsSubscribed: yes In this testcase, we were deducing T to be auto, which is nonsensical. Tested x86_64-pc-linux-gnu, applying to trunk. commit e8579febf0ce4e02b6b9c447c0f3adec56c66abc Author: Jason Merrill Date: Tue Feb 13 10:09:38 2018 -0500 PR c++/84080 - ICE with return type deduction and specialization. * pt.c (determine_specialization): Check uses_template_parms. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 02d448e99b6..222084df4cb 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2203,6 +2203,11 @@ determine_specialization (tree template_id, specialize TMPL will produce DECL. */ continue; + if (uses_template_parms (targs)) + /* We deduced something involving 'auto', which isn't a valid + template argument. */ + continue; + /* Remove, from the set of candidates, all those functions whose constraints are not satisfied. */ if (flag_concepts && !constraints_satisfied_p (fn, targs)) diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn47.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn47.C new file mode 100644 index 00000000000..7de2d9f9e5c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn47.C @@ -0,0 +1,6 @@ +// PR c++/84080 +// { dg-do compile { target c++14 } } + +template T foo(); + +template <> auto foo<0>() { return 42; } // { dg-error "does not match" }