From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2579 invoked by alias); 20 May 2011 19:46:00 -0000 Received: (qmail 2565 invoked by uid 22791); 20 May 2011 19:46:00 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ww0-f41.google.com (HELO mail-ww0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 20 May 2011 19:45:44 +0000 Received: by wwi18 with SMTP id 18so771804wwi.2 for ; Fri, 20 May 2011 12:45:43 -0700 (PDT) Received: by 10.216.6.27 with SMTP id 27mr4927wem.69.1305920742824; Fri, 20 May 2011 12:45:42 -0700 (PDT) Received: from cajmac.config (94-192-86-137.zone6.bethere.co.uk [94.192.86.137]) by mx.google.com with ESMTPS id p36sm2017323weq.33.2011.05.20.12.45.40 (version=SSLv3 cipher=OTHER); Fri, 20 May 2011 12:45:41 -0700 (PDT) Subject: Re: RFA (libstdc++): C++/v3 PATCH for c++/24163 (lookup in dependent bases) and c++/29131 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Christopher Jefferson In-Reply-To: <20110520193035.GA30195@synopsys.com> Date: Sat, 21 May 2011 03:01:00 -0000 Cc: Jason Merrill , gcc-patches List , Benjamin Kosnik , libstdc++ Content-Transfer-Encoding: quoted-printable Message-Id: <52A1AA49-7247-4560-976B-45F06F5E2497@bubblescope.net> References: <4DD69790.8070101@redhat.com> <20110520193035.GA30195@synopsys.com> To: Joe Buck 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-05/txt/msg01507.txt.bz2 On 20 May 2011, at 20:30, Joe Buck wrote: > On Fri, May 20, 2011 at 09:32:16AM -0700, Jason Merrill wrote: >> G++ has had a long-standing bug with unqualified name resolution in=20 >> templates: if we didn't find any declaration when looking up a name in=20 >> the template definition, we would do an additional unqualified lookup at= =20 >> the point of instantiation. This led to incorrectly finding=20 >> namespace-scope functions declared later (29131) and member functions of= =20 >> dependent bases (24163). This patch fixes that bug. >=20 > I get the impression that most competing C++ compilers (other than the > old HP compiler) were (or are) very loose about that rule. >=20 >> To be friendly to users, the patch also allows affected code to compile= =20 >> with -fpermissive and provides suggestions about how to fix the code:=20 >> either declaring the desired function earlier (29131) or explicitly=20 >> qualifying the name with this-> or Class:: (24163). >=20 > I think that it's quite likely that there is a lot of C++ code out there > that depends on this bug to compile. So I'm glad that you've included > user guidance in the error messages, and it would be interesting to see > how much code is affected when, say, compiling a distro. Fortunately clang already implements this rule correctly, so many code base= s are already getting fixed. I personally (with a couple of other people) f= ixed dozens of places in boost where this was breaking code. I expect this = to break huge amounts of code in g++-only code bases, but will also help im= prove compatibility with other compilers. I could see the temptation to introduce this as a mandatory warning for a w= hile, and only add it under -pedantic. However, it might be easier to just = force people to fix their code. Chris