From patchwork Mon Oct 23 20:36:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 829632 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-464901-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="izo/vBca"; 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 3yLSqV6SpLz9t16 for ; Tue, 24 Oct 2017 07:36:37 +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:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=mDsbZTmoez8sltfLCnoEHQUsH6ytyGtgyu8teqb77qNpew4VcF 3UdezY+IJOgkZbFtQKNmDsrPYo4gwgr0nrcFBTwnokHPPH4JebJK3jOSpK4FX55f dmKwtjtj3c/h1GKUS+fqkLfV8sJB8CXfBf0tZeRlHvzy+GMs5o+BLGN9E= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=3xoLze0HO1gFSE6LO32rFYJaQyA=; b=izo/vBcaXuvgOExeKju+ vSccKDKUms7g46O+0lYiKvrVbTlQDoRx7/n9W/OWnBIxvchWd/5E1Cxp23w45aMx RVzqrdc0j07Mmqlry/+gt1efsMo9OtesecLNmIokPXGEtn6lm1aVwge9RWXPV+wk BgzWGa/9B/vjywGkqg/aHYE= Received: (qmail 71788 invoked by alias); 23 Oct 2017 20:36:30 -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 71155 invoked by uid 89); 23 Oct 2017 20:36:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: aserp1040.oracle.com Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 20:36:29 +0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9NKaN9c024097 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Oct 2017 20:36:23 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v9NKaNVR013857 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Oct 2017 20:36:23 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v9NKaLj0029489; Mon, 23 Oct 2017 20:36:21 GMT Received: from [192.168.1.4] (/82.55.214.12) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 23 Oct 2017 13:36:20 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill , Nathan Sidwell From: Paolo Carlini Subject: [C++ Patch] PR 80449 ("[7/8 Regression] ICE reporting failed partial class template specialization class template argument deduction") Message-ID: Date: Mon, 23 Oct 2017 22:36:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, this issue is by and large a duplicate of C++/79790, which I already fixed. There is a minor remaining nit: for the testcase, after the correct:     error: cannot deduce template arguments of ‘C’, as it has no viable deduction guides we also emit the meaningless:     error: too many initializers for ‘’ only because in finish_compound_literal we don't check - as we do in most other places - the return value of do_auto_deduction for error_mark_node and it filters through until reshape_init. Tested x86_64-linux. Thanks, Paolo. //////////////////// /cp 2017-10-23 Paolo Carlini PR c++/80449 * semantics.c (finish_compound_literal): Check do_auto_deduction return value for error_mark_node. /testsuite 2017-10-23 Paolo Carlini PR c++/80449 * g++.dg/cpp1z/class-deduction46.C: New. Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 254005) +++ cp/semantics.c (working copy) @@ -2711,8 +2711,12 @@ finish_compound_literal (tree type, tree compound_ if (tree anode = type_uses_auto (type)) if (CLASS_PLACEHOLDER_TEMPLATE (anode)) - type = do_auto_deduction (type, compound_literal, anode, complain, - adc_variable_type); + { + type = do_auto_deduction (type, compound_literal, anode, complain, + adc_variable_type); + if (type == error_mark_node) + return error_mark_node; + } if (processing_template_decl) { Index: testsuite/g++.dg/cpp1z/class-deduction46.C =================================================================== --- testsuite/g++.dg/cpp1z/class-deduction46.C (nonexistent) +++ testsuite/g++.dg/cpp1z/class-deduction46.C (working copy) @@ -0,0 +1,6 @@ +// PR c++/80449 +// { dg-options -std=c++17 } + +template struct C; +template<> struct C { C(int, int) {} }; +auto k = C{0, 0}; // { dg-error "cannot deduce" }