From patchwork Wed Aug 1 12:07:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 952107 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-482885-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="bVg/6aii"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="17h224Sr"; 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 41gX9v24ndz9ryn for ; Wed, 1 Aug 2018 22:07:29 +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 :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=T9fQcacB04L1yRdHeAm3yMI7k1mVjVKqBGbkW21EzWz+C2ld8j wVnx9yUansHqVepTc8X6W09b6ZB7VjChl/MY3fn26g8+qTKuJiUGFo6TrcuCtWGe YTal0FApfbkAbBDIQ/1TLbKwFSRfKX6xc7Od8XmIlwdY0TKG7/e9rOCB8= 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 :from:subject:message-id:date:mime-version:content-type; s= default; bh=yZTCSUSWyeiuLEtVztAU13W+Ng8=; b=bVg/6aiiLJBSzBq/YSjK McGp1hdbVqWr9DSWEfKU0uCnnfT7Hv5jSGGE62NjVlCAMqRXKxY+Ij43bRgW9/xE 4tU0twbttzGCVmtEYaiXAAKMyDWhzxvwu3UVZV0xWLz3wllziL5mfLhA4/XhBT6T U1oPU8FGVsPaf4Lhn4gRi/4= Received: (qmail 90280 invoked by alias); 1 Aug 2018 12:07:23 -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 90265 invoked by uid 89); 1 Aug 2018 12:07:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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; Wed, 01 Aug 2018 12:07:19 +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 w71C3Yg1016008 for ; Wed, 1 Aug 2018 12:07:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : from : subject : message-id : date : mime-version : content-type; s=corp-2018-07-02; bh=1fHXfR/gMbm1t5sufQIgu02LKpmB2Ue2HbUT8DHEoo8=; b=17h224Sr8jKHxJc9Z9t/kAP8O3VkuNip6NxKVPOnCD2S3IEHy+u7mLK/rCAaIy8vZM07 zNg6o6EsWIe/c0nwmDtihTCbEJmA3pwNt6i3rQ09C/10TYaTDQxrk3PSussOGjpwnoKo l47fivL20QQ37BwPXnSoqlU3pd44mfYujbTrnrjQrBxvoBMNAFEfW3ngfDZK33O3lpMJ W6DBUHwJKaHZgZtk1Cet1vPVfytZVmhwgESL4vHZDvjKxIGj4exYVIyWZ3hjD2/xsTwN KlpsLLiG4EJx1OuQInYr3RwJujx0Ptha0ZNm8PAljdS2/HBkyovJ8yd3JlFgZkA/9a97 nQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2kgfwt5cnr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 01 Aug 2018 12:07:17 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w71C7HM3013363 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 1 Aug 2018 12:07:17 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w71C7GsS028462 for ; Wed, 1 Aug 2018 12:07:16 GMT Received: from [192.168.1.4] (/79.36.21.168) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 01 Aug 2018 05:07:16 -0700 To: "gcc-patches@gcc.gnu.org" From: Paolo Carlini Subject: [C++ Patch, obvious] PR 86661 Message-ID: <85998f72-ff47-9d8e-6f46-e6e096d3ef49@oracle.com> Date: Wed, 1 Aug 2018 14:07:13 +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, when I lately changed a couple of permerrors to permerror + warning and accurate location for the first call, I went for the simple choice of using DECL_SOURCE_LOCATION for the first call and keeping location_of in the second call. Turns out we consistently want location_of for both, because we may have to handle OVERLOADs. Tested x86_64-linux, committed to mainline. Thanks, Paolo. ///////////////////////// /cp 2018-08-01 Paolo Carlini PR c++/86661 * class.c (note_name_declared_in_class): Use location_of in permerror instead of DECL_SOURCE_LOCATION (for OVERLOADs). /testsuite 2018-08-01 Paolo Carlini PR c++/86661 * g++.dg/lookup/name-clash12.C: New. Index: cp/class.c =================================================================== --- cp/class.c (revision 263197) +++ cp/class.c (working copy) @@ -8285,7 +8285,7 @@ note_name_declared_in_class (tree name, tree decl) A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S. */ - if (permerror (DECL_SOURCE_LOCATION (decl), + if (permerror (location_of (decl), "declaration of %q#D changes meaning of %qD", decl, OVL_NAME (decl))) inform (location_of ((tree) n->value), Index: testsuite/g++.dg/lookup/name-clash12.C =================================================================== --- testsuite/g++.dg/lookup/name-clash12.C (nonexistent) +++ testsuite/g++.dg/lookup/name-clash12.C (working copy) @@ -0,0 +1,9 @@ +// PR c++/86661 + +typedef int a; // { dg-message "declared here" } +namespace { +class b { + a c; + template void a(); // { dg-error "changes meaning" } +}; +}