From patchwork Mon Jan 29 15:45:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 867162 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-472191-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="u2u5+S4O"; 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 3zVYkf5L4dz9s7M for ; Tue, 30 Jan 2018 02:45:45 +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=UtlUHDx8GIWGsjLBkJatDRC7lJfrEXuvqi2LjDrJO9MXoOokKu PUyStEMEDXNTtrtzKyMU4AhXdvOLeryKOHC8WqUO1RwBnuu4p9Mh2pEBmrHa2m6M My7GLAOndJpmmkbGichhlnF/gpwUQKoLLzhiN1HDFJLbuzeNNs5oRCLck= 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=hTmLx6ligBm2g6/dtpq8DqAru9s=; b=u2u5+S4OTtzCQUTRjZ4Y 2spZatIvBBx6yTS5f+aj3rSgQ0z65tdny7+gEKNs3/9JurvK0rah5hKMtDCXReml j0KTGER0FI85P3BTjwapA9WYRwkHR5ghFLxf+EHQWUNwOJEJMRMTfLBwbmAHTSTs pqalc2BsV9edyl9qbyKMpnQ= Received: (qmail 48684 invoked by alias); 29 Jan 2018 15:45:37 -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 48616 invoked by uid 89); 29 Jan 2018 15:45:30 -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, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= 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; Mon, 29 Jan 2018 15:45:28 +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 w0TFhk2C041483; Mon, 29 Jan 2018 15:45:27 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2ft59g8ebw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Jan 2018 15:45:27 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w0TFjQxj026410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 29 Jan 2018 15:45:26 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w0TFjQLC015371; Mon, 29 Jan 2018 15:45:26 GMT Received: from [192.168.1.4] (/79.52.198.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 29 Jan 2018 07:45:25 -0800 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 84092 ("[8 Regression] ICE on C++14 code with variable template: in build_qualified_name, at cp/tree.c:2043") Message-ID: <308f9750-52ed-4cd3-2340-50d189b24349@oracle.com> Date: Mon, 29 Jan 2018 16:45:23 +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=8789 signatures=668655 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-1801290207 X-IsSubscribed: yes Hi, the fix for c++/81236 removed some special code for dependent_p from finish_id_expression, and now finish_qualified_id_expr is used for this snippet too. Then special code at the beginning of the latter takes care of calling build_qualified_name to create the relevant SCOPE_REF. Therefore it seems to me that - unless we really want to return an OFFSET_REF - at that point we are done, we don't want to get to the end of the following long conditional and call again build_qualified_name on the SCOPE_REF and ICE. We don't need convert_from_reference either because build_qualified_name is passed a null type. Finishing testing (in the library) on x86_64-linux. Thanks! Paolo. //////////////////////// /cp 2018-01-29 Paolo Carlini PR c++/84092 * semantics.c (finish_qualified_id_expr): Maybe early return when handling an UNBOUND_CLASS_TEMPLATE. /testsuite 2018-01-29 Paolo Carlini PR c++/84092 * g++.dg/cpp1y/var-templ57.C: New. Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 257139) +++ cp/semantics.c (working copy) @@ -2001,12 +2001,16 @@ finish_qualified_id_expr (tree qualifying_class, if (template_p) { if (TREE_CODE (expr) == UNBOUND_CLASS_TEMPLATE) - /* cp_parser_lookup_name thought we were looking for a type, - but we're actually looking for a declaration. */ - expr = build_qualified_name (/*type*/NULL_TREE, - TYPE_CONTEXT (expr), - TYPE_IDENTIFIER (expr), - /*template_p*/true); + { + /* cp_parser_lookup_name thought we were looking for a type, + but we're actually looking for a declaration. */ + expr = build_qualified_name (/*type*/NULL_TREE, + TYPE_CONTEXT (expr), + TYPE_IDENTIFIER (expr), + /*template_p*/true); + if (!(address_p && done)) + return expr; + } else check_template_keyword (expr); } Index: testsuite/g++.dg/cpp1y/var-templ57.C =================================================================== --- testsuite/g++.dg/cpp1y/var-templ57.C (nonexistent) +++ testsuite/g++.dg/cpp1y/var-templ57.C (working copy) @@ -0,0 +1,4 @@ +// PR c++/84092 +// { dg-do compile { target c++14 } } + +template < typename T > int a (T::template b);