From patchwork Mon Jul 16 11:46:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 944343 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-481610-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="fnk5lYWh"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="JfvzBex+"; 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 41ThTf5jT7z9ryt for ; Mon, 16 Jul 2018 21:47:01 +1000 (AEST) 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=AYUc3ff4lntKMJNxhFAwElCjYX3g+2K9RATPk0y/Z8fOo8RlX9 C63WYbQesxwxnLOKs9kMpYdSjhd5yQN3KI2gRNSRMs9DuWiL6hUxnxAZFTYSu6kb HW9TL28iBUr7J0JpivxoWJlc8qUFg0SqKkiHx14yAPjQWPU6qb3i0DjMY= 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=jlDwD91vUKI3WxPtKaa3GBvnDeY=; b=fnk5lYWh7ccFQ43+9jJf uixG34pAqcKjTYpRqFMTkCpB+Zh1bheRp5YeEPMYgGb05TakSLPO+mS7xd3rDhPn M+6pPoFdFvtfrCBcEvsGbENkxrkeKINBKKwoPB8OMD7IqZqZlue7965RiZ7DV89k pijF+OehCyZNd1wXkjesDxY= Received: (qmail 63495 invoked by alias); 16 Jul 2018 11:46:54 -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 63484 invoked by uid 89); 16 Jul 2018 11:46:53 -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=input_location, UD:pt.c, pt.c, H*r:ip*192.168.1.4 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, 16 Jul 2018 11:46:52 +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 w6GBhSQb105279; Mon, 16 Jul 2018 11:46:50 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=4sqweOO3U6Lw0KG07wpQ6UZexLU23md8NEprflNnCkg=; b=JfvzBex+3bOrt8Ivv75maE9cLUzL0IQihOAsHtb+DewrabAK1hQi+0TnstxsTL+EoH46 TKS8b5yPE1WvP23Ycbq3A6Ye22w6kDK2jQdimV8ht2oAOrjLuAtMfUSN0D2V5vqXHCdA lhKLjeNXiI33YgSKAvIVCJe/Xxwcj8rCqkgfDbjs3oAaGDH5XyEQ8wOSrbIhlYcGAGfE 2CSLGt4MpmpkRuEh7KDQE0x8V/6+0r8ZE2xxs10h/iv7+XlnmWnyDIk4HPaw2dj4EI27 7TLbnvypnA2dkk5XckBPIIP/y+mDWI2OcTm0iCXudZtF0XiETjbMiXm07ObPTB4sLI6k pg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2k7a3sv1qs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Jul 2018 11:46:49 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6GBkn05019674 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Jul 2018 11:46:49 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 w6GBkmaq010029; Mon, 16 Jul 2018 11:46:48 GMT Received: from [192.168.1.4] (/79.27.215.86) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Jul 2018 04:46:47 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill , David Malcolm From: Paolo Carlini Subject: [C++ Patch] Check permerror return value Message-ID: <2d32996e-3e2f-87af-d9dd-268c6f167337@oracle.com> Date: Mon, 16 Jul 2018 13:46:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 X-IsSubscribed: yes Hi, over the last weeks, while working on various diagnostic issues, I noticed a few defective permerror + inform pairs. Tested x86_64-linux. Thanks, Paolo. //////////////////// /cp 2018-07-16 Paolo Carlini * class.c (resolve_address_of_overloaded_function): Don't emit an inform if the matching permerror returns false. * pt.c (check_specialization_namespace): Likewise. /testsuite 2018-07-16 Paolo Carlini * g++.dg/template/spec40.C: New. * g++.dg/parse/ptrmem8.C: Likewise. Index: cp/class.c =================================================================== --- cp/class.c (revision 262687) +++ cp/class.c (working copy) @@ -7919,10 +7919,11 @@ resolve_address_of_overloaded_function (tree targe if (!(complain & tf_error)) return error_mark_node; - permerror (input_location, "assuming pointer to member %qD", fn); - if (!explained) + if (permerror (input_location, "assuming pointer to member %qD", fn) + && !explained) { - inform (input_location, "(a pointer to member can only be formed with %<&%E%>)", fn); + inform (input_location, "(a pointer to member can only be " + "formed with %<&%E%>)", fn); explained = 1; } } Index: cp/pt.c =================================================================== --- cp/pt.c (revision 262687) +++ cp/pt.c (working copy) @@ -800,10 +800,10 @@ check_specialization_namespace (tree tmpl) return true; else { - permerror (input_location, - "specialization of %qD in different namespace", tmpl); - inform (DECL_SOURCE_LOCATION (tmpl), - " from definition of %q#D", tmpl); + if (permerror (input_location, + "specialization of %qD in different namespace", tmpl)) + inform (DECL_SOURCE_LOCATION (tmpl), + " from definition of %q#D", tmpl); return false; } } Index: testsuite/g++.dg/template/spec40.C =================================================================== --- testsuite/g++.dg/template/spec40.C (nonexistent) +++ testsuite/g++.dg/template/spec40.C (working copy) @@ -0,0 +1,12 @@ +// { dg-options "-fpermissive -w" } + +namespace N { + template + struct S { + void f() {} // { dg-bogus "from definition" } + }; +} + +namespace K { + template <> void N::S::f() {} +} Index: testsuite/g++.dg/parse/ptrmem8.C =================================================================== --- testsuite/g++.dg/parse/ptrmem8.C (nonexistent) +++ testsuite/g++.dg/parse/ptrmem8.C (working copy) @@ -0,0 +1,15 @@ +// { dg-options "-fpermissive -w" } + +struct A +{ + template void foo() + { + void (A::* fp)(); + fp = A::foo<0>; // { dg-bogus "pointer to member" } + } +}; + +void bar() +{ + A().foo<0>(); +}