From patchwork Thu Feb 15 22:56:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 874207 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-473373-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="BqkIiC3x"; 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 3zjBVK4dQPz9sRW for ; Fri, 16 Feb 2018 09:56:56 +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=rn0/9T5Ci6YwZ2AZ9Aij8yMyCQusGtfnI4MYuLfE/CHX0J/o10 cqngVaBVupKbW4tRyGhlYR1CVg/8PPF2S8KlA244G4n8S83zBk3TsYc/5PPAm0Kp W2jg6k3HyC8xLVLr+diUD6m/1XhAVfdyu4TG9cKvP4WKrtBsNO0gpLnC0= 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=5/kglOvd2dxzRnuM6mjF5dQub9E=; b=BqkIiC3xrJVjyO2RTqQ0 yuwYlIgSGNAv3sn7IKaX2LdCN0imC1LK056T2ZQ6Rfu0P6qnLkDlnc2sZffdWwOj AyXqFff+1wkGQfrRTD90fNIZb3NXRKn4WAWg4beb29lHunXX+uRSmgOyC4MsH0Ys EDFn0NuP3ahl6GqIc7+3vd0= Received: (qmail 70786 invoked by alias); 15 Feb 2018 22: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 70774 invoked by uid 89); 15 Feb 2018 22:56:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:2130 X-HELO: aserp2130.oracle.com Received: from aserp2130.oracle.com (HELO aserp2130.oracle.com) (141.146.126.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 15 Feb 2018 22:56:47 +0000 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1FMqoJp166765; Thu, 15 Feb 2018 22:56:41 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2g5kcur0fe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2018 22:56:41 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1FMue9e023055 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Feb 2018 22:56:41 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1FMubTw014751; Thu, 15 Feb 2018 22:56:37 GMT Received: from [192.168.1.4] (/79.52.198.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 15 Feb 2018 14:56:36 -0800 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 82468 ("[7/8 Regression] ICE with deduction guide template") Message-ID: Date: Thu, 15 Feb 2018 23:56:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8806 signatures=668672 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802150273 X-IsSubscribed: yes Hi, this issue is very easy to explain and the testcase minimal: check_special_function_return_type ICEs on a TEMPLATE_TEMPLATE_PARM as optype, because it tries to use CLASSTYPE_TI_TEMPLATE on it. Today, triangulating with other compilers too, I came to believe that here essentially we only have to provide sensible diagnostic and below is what I'm finishing testing on x86_64-linux (what about an additional inform using DECL_SOURCE_LOCATION (TYPE_STUB_DECL (optype))? I'm not sure, the rest of the function emits quite terse messages). Thanks! Paolo. ///////////////////////// /cp 2018-02-15 Paolo Carlini PR c++/82468 * decl.c (check_special_function_return_type): Reject template template parameter in deduction guide. /testsuite 2018-02-15 Paolo Carlini PR c++/82468 * g++.dg/cpp1z/class-deduction47.C: New. Index: cp/decl.c =================================================================== --- cp/decl.c (revision 257712) +++ cp/decl.c (working copy) @@ -9834,7 +9834,14 @@ check_special_function_return_type (special_functi error_at (smallest_type_quals_location (type_quals, locations), "qualifiers are not allowed on declaration of " "deduction guide"); - type = make_template_placeholder (CLASSTYPE_TI_TEMPLATE (optype)); + if (TREE_CODE (optype) == TEMPLATE_TEMPLATE_PARM) + { + error ("template template parameter %qT in declaration of " + "deduction guide", optype); + type = error_mark_node; + } + else + type = make_template_placeholder (CLASSTYPE_TI_TEMPLATE (optype)); for (int i = 0; i < ds_last; ++i) if (i != ds_explicit && locations[i]) error_at (locations[i], Index: testsuite/g++.dg/cpp1z/class-deduction47.C =================================================================== --- testsuite/g++.dg/cpp1z/class-deduction47.C (nonexistent) +++ testsuite/g++.dg/cpp1z/class-deduction47.C (working copy) @@ -0,0 +1,5 @@ +// PR c++/82468 +// { dg-options -std=c++17 } + +template