From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26589 invoked by alias); 13 Jul 2002 10:26:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 26575 invoked by uid 71); 13 Jul 2002 10:26:00 -0000 Date: Sat, 13 Jul 2002 03:26:00 -0000 Message-ID: <20020713102600.26574.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Kriang Lerdsuwanakij Subject: Re: c++/7218: incorrect 'implicit typename' warnings Reply-To: Kriang Lerdsuwanakij X-SW-Source: 2002-07/txt/msg00420.txt.bz2 List-Id: The following reply was made to PR c++/7218; it has been noted by GNATS. From: Kriang Lerdsuwanakij To: Ryohei Noda Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, lerdsuwa@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org Subject: Re: c++/7218: incorrect 'implicit typename' warnings Date: Sat, 13 Jul 2002 17:25:07 +0700 Ryohei Noda wrote: > > lerdsuwa: > > Thank you for your reply. > But I have not convinced. > > The C++ ISO Standard(14882:1998) reads: > 14.6 8(p259) > > The lookup of names dependent on the template parameter is > > postponed until the actual template argument is known(14.6.2). > > Compiler should not complain about failing to look up AA > when parsing the code. > > 14.6.2 3 > > In the definition of a class template or in the definition of > > a member of such a template that appears outside of the template > > definition, if a base class of this template depends on a > > template-parameter, > > the base class scope is not examined during name lookup > > until the class template is instantiated. > > The base class scope is examined, > after the actual template argument is known and the class template > (and implicitly the base class template)are instantiated. > > Have I something misineterpreted? You're incorrect about whether the name 'AA' is template parameter dependent. Take a look at your code (which is the same as the one in 14.6.2 3 except various name interchange): template struct B : A { AA a;}; 'AA' specified this way is NOT a template parameter dependent name according to 14.6.2.1 1. This 'AA' must be looked up in the scope that contain the template class 'B'. But the name is not found. So the code parsing fails and you see the warning message. To force the compiler to behave like 14.6 8 and 14.6.2 3 you mentioned. You must force GCC to view 'AA' as a dependent name. Because base class 'A' is template parameter dependent. You can form a type dependent via 14.6.2.1 1 case 2 (a qualified-id with a nested-name-specifier which contains a class-name that names a dependent type), i.e. 'typename A::B'. 'typename A::B' is a qualified-id. Its nested-name-specifier is 'A'. --Kriang > > > Date: 11 Jul 2002 14:50:01 -0000 > > lerdsuwa@gcc.gnu.org Re: c++/7218: incorrect 'implicit typename' warnings > >Synopsis: incorrect 'implicit typename' warnings > > > >State-Changed-From-To: open->closed > >State-Changed-By: lerdsuwa > >State-Changed-When: Thu Jul 11 07:50:00 2002 > >State-Changed-Why: > > Not a bug. AA is inside template-parameter dependent > > base class. When parsing class B, names inside A > > are not looked up. You have to write > > template > > struct B : A { typename A::AA a;}; > > > >http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7218 > > ------------------------------------------------------------ > Your Free, Private, Fast, E-mail and WebSite: http://MdCplus.com/email > Join the MdCplus affiliates program and Make MONEY: http://MdCplus.com/$/?bmb > > --------------------------------------------------------------------- > Express yourself with a super cool email address from BigMailBox.com. > Hundreds of choices. It's free! > http://www.bigmailbox.com > ---------------------------------------------------------------------