From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5808 invoked by alias); 21 Sep 2011 15:14:10 -0000 Received: (qmail 5794 invoked by uid 22791); 21 Sep 2011 15:14:09 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Sep 2011 15:13:55 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p8LFDqJZ002127 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 21 Sep 2011 15:13:54 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8LFDpl7028801 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 21 Sep 2011 15:13:52 GMT Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8LFDksA012695; Wed, 21 Sep 2011 10:13:46 -0500 Received: from [192.168.1.4] (/79.45.212.208) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 21 Sep 2011 08:13:46 -0700 Message-ID: <4E79FEF9.7080704@oracle.com> Date: Wed, 21 Sep 2011 16:00:00 -0000 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110907 Thunderbird/6.0.2 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 50344 Content-Type: multipart/mixed; boundary="------------040003000604000701080802" X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg01255.txt.bz2 This is a multi-part message in MIME format. --------------040003000604000701080802 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 273 Hi, basing on [class.friend] (11.3/3) in C++11 I think Jon is right that cv-qualification should be ok in a friend declaration. I'm not sure, however, if we want to somehow allow that also in c++98 mode... Tested x86_64-linux. Ok? Thanks, Paolo. /////////////////// --------------040003000604000701080802 Content-Type: text/plain; name="CL_50344" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="CL_50344" Content-length: 368 /cp 2011-09-21 Paolo Carlini Jonathan Wakely PR c++/50344 * friend.c (make_friend_class): In c++0x mode, cv-qualification is ok in a friend declaration. /cp 2011-09-21 Paolo Carlini Jonathan Wakely PR c++/50344 * g++.dg/cpp0x/friend3.C: New. --------------040003000604000701080802 Content-Type: text/plain; name="patch_50344" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch_50344" Content-length: 1157 Index: testsuite/g++.dg/cpp0x/friend3.C =================================================================== --- testsuite/g++.dg/cpp0x/friend3.C (revision 0) +++ testsuite/g++.dg/cpp0x/friend3.C (revision 0) @@ -0,0 +1,17 @@ +// PR c++/50344 +// { dg-options -std=c++0x } + +template class C +{ + friend T; + int i; +}; + +struct S +{ + int f() + { + C c; + return c.i; + } +}; Index: cp/friend.c =================================================================== --- cp/friend.c (revision 179049) +++ cp/friend.c (working copy) @@ -1,6 +1,6 @@ /* Help friends in C++. Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2007, 2008, 2010 Free Software Foundation, Inc. + 2007, 2008, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -236,6 +236,8 @@ make_friend_class (tree type, tree friend_type, bo "invalid type %qT declared %", friend_type); return; } + else if (cxx_dialect >= cxx0x) + friend_type = cv_unqualified (friend_type); if (friend_depth) /* If the TYPE is a template then it makes sense for it to be --------------040003000604000701080802--