From patchwork Sat Nov 17 10:00:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 999276 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-490361-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ICSH8qBj"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="wndSFUMU"; 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 42xrGN0S9Fz9s1x for ; Sat, 17 Nov 2018 21:01:13 +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=Uh76ZASzBWWgtcWh26LtXkujnsksddwr5MUt0+hUlNkOnN4sS+ XQA7/H417zCPGYGZG3VeGS/5gXzvRyaAy7Jipl4DOZy4Q4AP8WsuWliarHsoC9lb twnfE+wlNmbLwXKiDXQjQuyh92fnDETVc0xNOtyWbfcJZ1ABcjo81GZPU= 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=n2PUqIFQdZxjg59q1ZCeuRT/5vs=; b=ICSH8qBjw6TZLaUCueri KrG0DqNsgjdPGByqD2tysIX0Penb0kltjkWj8kKggKRtgb8sJk553amYVuRS5o4V Td5cwOnRj8O2yi02PbWpq2bi7HkUm18MB5SpwvCv3cXpWAsbY+aKhhjLQpiujHlk lp5gDUC3Afi4pxG1/5VQz4s= Received: (qmail 57824 invoked by alias); 17 Nov 2018 10:01:06 -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 57511 invoked by uid 89); 17 Nov 2018 10:00:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=kosher, person X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 17 Nov 2018 10:00:51 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAH9xm27076603; Sat, 17 Nov 2018 10:00:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2018-07-02; bh=9E1WG13EzJ/YqyhsNGlEh9aWV2Qc43m0+Kp069aGjqE=; b=wndSFUMUUlvldL9SjH1K8nwbc3mXG25VmR6cKVBeSnybBREs2uGmJBEANLq/AK2Oxo6o kSe9EuRye/vyV5tWB7EyIS3o4PUQ2h00ysgJzRHr4003PdqzuT8u+bYa2ywUXgMOa5/q x04HQoQ1qsVKuGLPeJoGCHLABVmEbshkEBqJrsuM/yf4Bpwf3Mlfsfee838Yb1rvSCC7 pKDP8QpigGiDplra5363c4Zbafx2phgxTDddk5WtQe27f3p4UozByVQfI/48TDAgNZt3 oqCbCLcIkN4NmzG5WdaH3+NO9hH/eWUrlg1fojfxdgUMcBEWbKXEuDO31+A7olBT8T8o lQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2ntadtgkf9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 17 Nov 2018 10:00:48 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAHA0mEv031572 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 17 Nov 2018 10:00:48 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wAHA0ldY030400; Sat, 17 Nov 2018 10:00:48 GMT Received: from [192.168.1.4] (/87.10.221.76) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 17 Nov 2018 02:00:47 -0800 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] Remove obsolete _vptr check (and fix location) Message-ID: <098b6ade-1450-ffd4-5574-7661820a2b85@oracle.com> Date: Sat, 17 Nov 2018 11:00:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, while I was working on some location issues I noticed this check which seems obsolete to me and means that we unnecessarily reject kosher code: indeed we don't test for it anywhere and neither ICC nor clang enforce it. I also went through the SVN history and the check is *extremely* old, I think rms is the last person who touched it. The location fix is rather obvious (in principle we could do the same for the check I'm proposing to remove). Tested 86_64-linux. Thanks, Paolo. ///////////////////// /cp 2018-11-17 Paolo Carlini * decl2.c (grokfield): Remove obsolete _vptr check; fix explicit template argument list error location. /testsuite 2018-11-17 Paolo Carlini * g++.dg/template/crash91.C: Check location too. Index: cp/decl2.c =================================================================== --- cp/decl2.c (revision 266233) +++ cp/decl2.c (working copy) @@ -804,7 +804,6 @@ grokfield (const cp_declarator *declarator, tree value; const char *asmspec = 0; int flags; - tree name; if (init && TREE_CODE (init) == TREE_LIST @@ -829,21 +828,12 @@ grokfield (const cp_declarator *declarator, if (value == void_type_node) return value; - - name = DECL_NAME (value); - - if (name != NULL_TREE) + if (DECL_NAME (value) + && TREE_CODE (DECL_NAME (value)) == TEMPLATE_ID_EXPR) { - if (TREE_CODE (name) == TEMPLATE_ID_EXPR) - { - error ("explicit template argument list not allowed"); - return error_mark_node; - } - - if (IDENTIFIER_POINTER (name)[0] == '_' - && id_equal (name, "_vptr")) - error ("member %qD conflicts with virtual function table field name", - value); + error_at (declarator->id_loc, + "explicit template argument list not allowed"); + return error_mark_node; } /* Stash away type declarations. */ Index: testsuite/g++.dg/template/crash91.C =================================================================== --- testsuite/g++.dg/template/crash91.C (revision 266231) +++ testsuite/g++.dg/template/crash91.C (working copy) @@ -4,5 +4,5 @@ template void foo(); struct A { - typedef void foo<0>(); // { dg-error "explicit template argument list not allowed" } + typedef void foo<0>(); // { dg-error "16:explicit template argument list not allowed" } };